home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / KWS142.ZIP / KWS.DOC < prev    next >
Text File  |  1993-09-17  |  21KB  |  502 lines

  1.  
  2.  
  3.  
  4.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 1
  5.  
  6.  
  7.      DESCRIPTION
  8.      -----------
  9.      KWS (KeyWord Search) is a small, fast program that searches for key-
  10.      words within text and binary files. KWS has many features and options:
  11.  
  12.       * Handles grep, boolean, prefix, suffix, whole word, case-sensitive,
  13.         and adjustable fuzzy searches.
  14.  
  15.       * Supports wildcards and @filelists, and can span subdirectories.
  16.  
  17.       * Can display matches in bold onscreen, and can also display line
  18.         numbers, file offsets, and totals.
  19.  
  20.       * Can read data from standard input, from hidden/system files, and
  21.         from text files created on other platforms.
  22.  
  23.       * Accepts input lines up to 2k in length, and can handle 4DOS/NDOS
  24.         256-character command lines.
  25.  
  26.       * Much more...
  27.  
  28.  
  29.      REQUIREMENTS
  30.      ------------
  31.      KWS will run on any PC compatible using DOS 2.0 or higher.
  32.  
  33.  
  34.      DISCLAIMER
  35.      ----------
  36.      KWS is distributed on an "AS IS" basis without warranty, expressed or
  37.      implied. Considerable testing effort has been expended, but the user
  38.      is advised to check the program's suitability before relying on it.
  39.      The user assumes full risk as to the results of using this program. In
  40.      no event shall the author be liable for any incidental or consequent-
  41.      ial damages arising from the use, or inability to use this program.
  42.  
  43.  
  44.      REGISTRATION
  45.      ------------
  46.      The unregistered version of KWS is freely distributable and fully
  47.      functional, and may be used for a 30-day trial period. If you plan to
  48.      continue using KWS, you are obligated to pay the modest registration
  49.      fee. Registered users will receive a serialized, nag-free version of
  50.      KWS, a free upgrade when available, and $5 subsequent upgrades.
  51.  
  52.      All registration information is contained in the KWS.REG file. If that
  53.      file is missing, register by sending your name and address (please
  54.      print), along with $20 (cash, check, or money order in US funds) to:
  55.  
  56.         Copy Con Incorporated
  57.         PO Box 23255
  58.         Baltimore MD 21203-5255
  59.  
  60.      Please specify 3.5" or 5.25" diskette. MD residents add 5% sales tax.
  61.      Thank you for supporting Shareware.
  62.  
  63.  
  64.  
  65.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 2
  66.  
  67.  
  68.      OPERATION
  69.      ---------
  70.      KWS is activated from the command line, using the format
  71.  
  72.         KWS [@]filename search_string[...] [options]
  73.  
  74.      Parameters surrounded by [brackets] are optional.
  75.  
  76.      The filename is the filespec to be searched. Wildcards are optional.
  77.      (For a description of wildcards and filespecs, see your DOS manual.)
  78.      If the @ symbol is used, the filename is instead the name of a text
  79.      file containing valid filespecs; the files to be searched will be read
  80.      from that file list. Each filespec in the file list will be searched
  81.      relative to the current directory.
  82.  
  83.      Each search string is comprised of keywords separated by semicolons.
  84.      At least one keyword from each search string must be present in a
  85.      given line for it to be displayed; for example,
  86.  
  87.         KWS allfiles.lst fixed;hard disk;drive
  88.  
  89.      will display the lines in file ALLFILES.LST that contain either words
  90.      FIXED or HARD (or both), and also contain either words DISK or DRIVE.
  91.  
  92.      If a search string contains a keyword with embedded spaces or with a
  93.      redirection character (>,<, or |), the entire search string must be
  94.      enclosed in quotes; for example,
  95.  
  96.         KWS temp.bat "del *;era *"
  97.  
  98.      will search TEMP.BAT for phrases "del *" or "era *" (without quotes).
  99.  
  100.      A logical 'NOT' search can be conducted by preceding a keyword with
  101.      an exclamation (!) character; for example,
  102.  
  103.         KWS stuff.txt this !that
  104.  
  105.      will display the lines in STUFF.TXT that contain the word THIS and not
  106.      the word THAT. If you wish to search for an exclamation as the first
  107.      (or only) character of a keyword, use two in a row; for example,
  108.  
  109.         KWS stuff.txt this !!that
  110.  
  111.      will display lines that contain both words THIS and !THAT. Exclamation
  112.      characters inside or following keywords (as in "HEY!" or "What!?") do
  113.      not have to be doubled.
  114.  
  115.      A fuzzy search can be conducted by preceding a keyword with a tilde
  116.      (~) character; lines with words that are similar to the keyword will
  117.      be displayed. This option is useful if you aren't sure of a keyword's
  118.      correct spelling, or if a keyword may be spelled incorrectly in the
  119.      files to be searched; for example,
  120.  
  121.         KWS gnu.txt ~copyrite
  122.  
  123.  
  124.  
  125.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 3
  126.  
  127.  
  128.      OPERATION (continued)
  129.      ---------------------
  130.      will display lines with words similar to COPYRITE. (The similarity
  131.      percentage can be adjusted with the /F option.) If you wish to combine
  132.      a fuzzy search with a logical 'NOT' search, use the 'NOT' character
  133.      before the tilde (as in "!~THE"). Fuzzy searches cannot be combined
  134.      with prefix/suffix/whole word searches (described below).
  135.  
  136.      Whole word searches can be conducted by putting underscore (_)
  137.      characters before and after the keyword; for example,
  138.  
  139.         KWS files.lst _c_ source
  140.  
  141.      will display lines in FILES.LST that contain a lone 'C' and the word
  142.      SOURCE. Similarly, prefixes can be searched for by putting an
  143.      underscore before a keyword, and suffixes can be searched for by
  144.      putting an underscore after a keyword. If you wish to search for an
  145.      underscore as the first or last (or only) character of a keyword, use
  146.      two underscores in a row, as with the logical 'NOT' exclamation
  147.      character above. If you wish to combine a prefix/whole word search
  148.      with a logical 'NOT' search, use the 'NOT' character before the
  149.      underscore (as in "!_the_"). Prefix/suffix/whole word searches cannot
  150.      be combined with fuzzy searches (described above).
  151.  
  152.      Up to 10 search strings are allowed, with up to 10 keywords per
  153.      string.
  154.  
  155.  
  156.      OPTIONS
  157.      -------
  158.      Options can appear anywhere on the command line after the filespec.
  159.      They can be in any order, and are not case-sensitive. Options can be
  160.      separated by spaces (/L3 /P /T) or strung together (/L3/P/T or /L3PT).
  161.  
  162.      Option   Description
  163.  
  164.        /A     When this option is used, all binary files will automatically
  165.               be shown with hexadecimal file offsets.
  166.  
  167.        /B,B0  These options make all matches appear in bold type onscreen.
  168.               /B uses direct screen writes; /B0 uses BIOS screen writes,
  169.               which are slower, but compatible with more video systems.
  170.               When using either option, output cannot be routed using DOS
  171.               redirection; use the /O option to redirect output.
  172.  
  173.        /C     Search will be case-sensitive. Case-sensitive searches are
  174.               approximately 20% faster than case-insensitive searches.
  175.  
  176.        /D     Control characters (ASCII value less than 32) in text files
  177.               will be replaced with spaces before being viewed or routed.
  178.  
  179.        /E     The command line will be echoed as the first output line.
  180.               Useful mainly with redirected files to avoid repetition, and
  181.               for testing batch files.
  182.  
  183.  
  184.  
  185.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 4
  186.  
  187.  
  188.      OPTIONS (continued)
  189.      -------------------
  190.        /Fn    This option controls the similarity percentage for fuzzy
  191.               searches. Similarity defaults to 65 percent, and can be
  192.               adjusted from 0 (display almost every line) to 100 (display
  193.               exact matches).
  194.  
  195.        /G     This option puts KWS into regular expression mode, where
  196.               certain characters within keywords have special meaning:
  197.  
  198.               *  An asterisk matches zero or more characters; for example,
  199.                  E*T matches ET, EAT, or EDIT.
  200.  
  201.               ?  A question mark matches any one character; for example,
  202.                  E?T matches EAT, EDT, or EST.
  203.  
  204.               ^  A circumflex at the start of a keyword matches the start
  205.                  of a line.
  206.  
  207.               $  A dollar sign at the end of a keyword matches the end of a
  208.                  line.
  209.  
  210.               [] A string enclosed in brackets matches any character in
  211.                  that string, but no others. If the first character in the
  212.                  string is a circumflex (^), the expression matches any
  213.                  character except the characters in the string. For
  214.                  example, [XYZ] matches X, Y, or Z, while [^XYZ] matches
  215.                  any character except X, Y, or Z. A range of characters can
  216.                  be specified with two characters separated by a hyphen
  217.                  (-); these can be combined to form expressions like
  218.                  [A-BD-Z?], which matches the ? character and any letter
  219.                  except C.
  220.  
  221.               \  A backslash tells KWS to search for the literal character
  222.                  that follows it; for example, \* searches for an asterisk
  223.                  instead of searching for zero or more characters.
  224.  
  225.        /H     Hidden and/or system files will also be searched.
  226.  
  227.        /I     Ignore the config file, if present (see CONFIGURATION FILE).
  228.               If stringing options together, this option must be the first
  229.               in the string; for example, use "/ip" instead of "/pi".
  230.  
  231.        /J[n]  Use the viewer defined in the config file to display matches
  232.               (see CONFIGURATION FILE). The number, if specified, is the
  233.               number of lines before the match to start viewing from.
  234.  
  235.        /Kc    Change the keyword separator charactor from a semicolon to
  236.               the specified character. This option may be needed to pass
  237.               multiple keyword parameters to a batch file (as some versions
  238.               of DOS remove semicolons from batch parameters), or if a
  239.               semicolon is part of a keyword to be searched.
  240.  
  241.  
  242.  
  243.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 5
  244.  
  245.  
  246.      OPTIONS (continued)
  247.      -------------------
  248.        /L[n]  Line numbers or file offset position will be displayed with
  249.               output. If the specified width begins with a zero, then the
  250.               file offset will be displayed; otherwise, line numbers will
  251.               be displayed. If no width is specified, the numbers will be
  252.               left-justified, with a colon between the number and the text;
  253.               otherwise, the numbers will be right-justified and zero-
  254.               padded to the left, followed by the colon and text. If the
  255.               specified width is too small for a number to fit, the number
  256.               will NOT be truncated.
  257.  
  258.        /M[n]  Stop searching after n matches per file. /M alone will cause
  259.               KWS to print only the filenames of successful searches, and
  260.               these can be redirected to a file to be used as a file list.
  261.  
  262.        /Ofn   Route output to the specified device/filename. Output will be
  263.               in addition to, not instead of, output displayed onscreen. To
  264.               route output without viewing, use DOS redirection instead of
  265.               this option (see your DOS manual for details). Do not append
  266.               other options on to the end of this option, as they will be
  267.               mistaken as part of the device/filename.
  268.  
  269.        /P[n]  Pause between each screen of text. If no height is specified,
  270.               KWS will autodetect your screen size, and pause accordingly;
  271.               otherwise, KWS will pause after every n lines. While paused,
  272.               pressing the 'C' key will display the current and any
  273.               remaining files continuously. Pressing the Escape key while
  274.               paused will skip the current file and go on to the next.
  275.  
  276.        /R     Instead of reading from text files, KWS will read from
  277.               standard input. When in this mode, the /V option will be
  278.               inactive. Do not specify a filename when using this option.
  279.  
  280.        /S     Subdirectories will also be searched. This option is valid
  281.               only with wildcard and file list searches.
  282.  
  283.        /T,T0  Display total lines found per file. /T will display lines and
  284.               totals; /T0 will display totals only. For wildcard and file
  285.               list searches, a grand total will also be displayed.
  286.  
  287.        /V     If KWS cannot determine if a file is binary or text, text is
  288.               assumed; using this option will tell KWS to treat all files
  289.               as binary. This option is inactive when using the /R option.
  290.  
  291.        /Wn    Normally, all keywords must be on the same line for the line
  292.               to be displayed; use this option to look at more than one
  293.               line at a time. If all keywords are found within the
  294.               specified window size (maximum of 32767 lines), then the
  295.               lines will be displayed, starting with the first line to
  296.               contain a keyword, and ending with the last line to contain a
  297.               keyword. This option is inactive when searching binary files.
  298.  
  299.        /X     Line numbers and offsets will be displayed in hexadecimal.
  300.  
  301.  
  302.  
  303.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 6
  304.  
  305.  
  306.      CONFIGURATION FILE
  307.      ------------------
  308.      Under DOS 3.0 or higher, a default configuration for KWS can be stored
  309.      in a text file. If a file named KWS.CFG is in the same directory as
  310.      KWS.EXE, KWS will read default configuration values from the CFG file.
  311.      The config file can be ignored by using the /I option.
  312.  
  313.      Each line of the file consists of a configuration item, an equal sign,
  314.      and the item's value.
  315.  
  316.      Item     Description
  317.  
  318.      OPTIONS  For specifying default command line option values. As with
  319.               command line options, case is not important, and the options
  320.               may be strung together. Any options enabled in the config
  321.               file can be disabled on the command line by specifying the
  322.               option with a minus sign appended. For example, with a config
  323.               file that reads
  324.  
  325.                   options=/b /p
  326.  
  327.               bold keywords and screen pausing will be in effect whenever
  328.               KWS is run. To disable bold keywords, "/b-" can be specified
  329.               on the command line.
  330.  
  331.      VIEWER   Determines what program is run when the /J option is used.
  332.               The value specified is the command line to execute. If "!F"
  333.               or "!f" is encountered on the line, it will be replaced with
  334.               the current file name before executing, and "!L" or "!l" will
  335.               be replaced with the current line number. For example, if a
  336.               match is found on line 30 of FILES.LST, and
  337.  
  338.                   viewer=c:\utils\list.com !f /#:!l /l-
  339.  
  340.               is in your config file, KWS will execute:
  341.  
  342.                   C:\UTILS\LIST.COM FILES.LST /#:30 /l-
  343.  
  344.  
  345.      EXAMPLES
  346.      --------
  347.      KWS catalog.lst dvorak keyboard /p
  348.        will take the lines in file CATALOG.LST that contain the words
  349.        DVORAK and KEYBOARD, and display them one screen at a time (P).
  350.  
  351.      KWS catalog.lst arc;lzh shell /l5 /oprn
  352.        will take the lines in file CATALOG.LST that contain either ARC or
  353.        LZH, and also contain SHELL, and display them onscreen with line
  354.        numbers (L5), while sending them to the printer (OPRN).
  355.  
  356.      KWS allfiles.lst /c !.ZIP >nozip.lst
  357.        will make a file called NOZIP.LST, which will contain all of the
  358.        lines in ALLFILES.LST that do NOT contain the word .ZIP in caps (C).
  359.        Output will not be seen onscreen.
  360.  
  361.  
  362.  
  363.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 7
  364.  
  365.  
  366.      EXAMPLES (continued)
  367.      --------------------
  368.      KWS \dl\*.lst MIDI /ptc
  369.        will search all .LST files in the DL directory for the word MIDI in
  370.        capital letters (C), and displays the filenames and lines onscreen,
  371.        one screen at a time (P), with totals (T) for each file.
  372.  
  373.      KWS *.bak _the_
  374.        will search the backup files for lines that contain the word THE,
  375.        but will not display them if THE is part of another word (as in
  376.        THESIS or OTHER).
  377.  
  378.      KWS temp.bak _the_; /b
  379.        will display every line in TEMP.BAK, hilighting (B) any occurrance
  380.        of the word THE.
  381.  
  382.      KWS c:\*.bat _del;_era /s/h
  383.        will search all (S) of the batch files on the C: drive, including
  384.        those with their hidden and/or system attributes set (H), to see if
  385.        any of them delete/erase files.
  386.  
  387.      dir | KWS -92 /r
  388.        pipes the output from the DIR command into KWS (R), which will
  389.        display the directory entries from 1992.
  390.  
  391.      KWS ; /r /l3 <one.txt >two.txt
  392.        creates file TWO.TXT which is a duplicate of file ONE.TXT, except
  393.        that TWO.TXT will have 3-digit line numbers (L3). (A search for the
  394.        keyword separator will find every line.)
  395.  
  396.      KWS unix.man ; >unix.doc
  397.        converts a Unix format text file (LF delimited) into a DOS format
  398.        text file (CR/LF delimited). KWS can also read CR delimited files.
  399.  
  400.      KWS *.doc ~copyrite /f70b
  401.        will search the .DOC files for words similar to COPYRITE, hilighting
  402.        any close calls (F70).
  403.  
  404.      KWS *.doc ~copyrite !1993 /f70b
  405.        will display the same lines as the above example, except for lines
  406.        containing the word 1993.
  407.  
  408.      KWS allfiles.lst _c_;assem;asm src;source /pb
  409.        will display all lines in ALLFILES.LST that have to do with C or
  410.        assembler source code. Keywords will be in bold (B), and output will
  411.        be paused after each screen (P).
  412.  
  413.      KWS allfiles.lst _c_;assem;asm src;source !c++ /pb
  414.        will display the same as above, except C++ files will not be shown.
  415.  
  416.      KWS \dl\*.gif GIFLITE /cm
  417.        looks inside of GIF files to see if any have been GIFLITEd, showing
  418.        the filenames (M) of those that have.
  419.  
  420.  
  421.  
  422.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 8
  423.  
  424.  
  425.      EXAMPLES (continued)
  426.      --------------------
  427.      KWS \*.com ; /hal6p /od:com.txt
  428.        examines all (even hidden/system) .COM files in the root directory,
  429.        using hex (A) file offsets 6 characters wide (L6), pausing at each
  430.        screen (P), while also sending output to file COM.TXT on the D:
  431.        drive (OD:COM.TXT).
  432.  
  433.      KWS telix.use download file /w2
  434.        searches a Telix usage log, looking at two lines at a time (W2), to
  435.        see what files were downloaded.
  436.  
  437.      KWS kws.doc ; /pdolpt2
  438.        displays this file, one screen at a time (P), removing embedded
  439.        formfeed characters (D), while also sending output to printer LPT2
  440.        (OLPT2).
  441.  
  442.      KWS c:\*.bat ; /sm >filelist.txt
  443.        will create a file named FILELIST.TXT containing the names of all
  444.        (S) of the batch files on the C: drive. This file is used in the
  445.        next example.
  446.  
  447.      KWS @filelist.txt label "if %;goto"
  448.        will search the filenames in FILELIST.TXT, and display lines in
  449.        those files that contain the word LABEL and either the word GOTO or
  450.        the phrase "IF %" (without the quotes). Note that this example has
  451.        only two search strings, not three; if any words in a search string
  452.        contain spaces, then the entire search string must be in quotes.
  453.  
  454.      KWS @filelist.txt label "if %;goto" /j3
  455.        will conduct the same search as above, but the program specified in
  456.        the configuration file under VIEWER will be used to show each match.
  457.        Viewing will start 3 lines before the actual match.
  458.  
  459.  
  460.      RETURN CODES
  461.      ------------
  462.      The DOS errorlevel will be set if a search is unsuccessful:
  463.  
  464.      Level  Description
  465.  
  466.        1    Invalid command line options
  467.  
  468.        2    None of the files contain the search string(s)
  469.  
  470.        3    Ctrl-Break interrupt
  471.  
  472.        4    Invalid directory specified
  473.  
  474.        5    No files match filespec
  475.  
  476.        6    Unable to open output file
  477.  
  478.  
  479.  
  480.      KWS V1.42 Copyright (c) 1991-1993 Copy Con Incorporated         Page 9
  481.  
  482.  
  483.      SUPPORT
  484.      -------
  485.      If you have questions, comments, suggestions, bug reports, et cetera,
  486.      feel free to contact me by any of the following methods:
  487.  
  488.      1: By modem at The Programmer's Corner (301-596-7692 or 410-995-6873).
  489.         Send a message to RD Thomas in the Shareware or General conference,
  490.         and check back in a couple of days for a reply.
  491.  
  492.      2: On a BBS that carries the RIME Shareware conference (RD Thomas,
  493.         node ->1520). Allow at least one week for a reply.
  494.  
  495.      3: By US Mail at the address given on the first page. If you would
  496.         like a reply, please include a self-addressed, stamped envelope.
  497.  
  498.      Looking forward to hearing from you.
  499.  
  500.  
  501.      To print this document, type "COPY KWS.DOC PRN" at the DOS prompt.
  502.