home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / FIND.ARC / FIND.DOC < prev   
Text File  |  1990-07-21  |  4KB  |  114 lines

  1. The FIND utility has been in the public domain in various 
  2. forms for some years now.  This version is one of the best, 
  3. approaching GREP in power while being reasonably quick in 
  4. operation and small in code size.  It can also handle squeezed 
  5. files.
  6.  
  7. FIND searches (squeezed or plain) text files for things.  You 
  8. tell it the names of the files you want to search and what you 
  9. want to look for, e.g.
  10.  
  11.                find *.m?c [hl|de],({?})
  12.  
  13. The above invocation of find will search all the .MAC (and 
  14. .MQC) files for lines containing "hl" or "de" followed by a 
  15. comma and something in parentheses.
  16. ~
  17. FIND expects two arguments on the command line.  The first 
  18. tells FIND the name(s) of the files you want to search, the 
  19. second tells it what to look for.  FIND scans each of the 
  20. files trying to match the text therein with the pattern 
  21. represented by the second argument.  Searching is done on a 
  22. line-by-line basis.
  23.  
  24. A simple form of the FIND command might be:
  25.  
  26.                find *.c? putc
  27.  
  28. This tells FIND to scan all the .C (and .CQ) files in the 
  29. current disk and user area looking for the string "putc".  
  30. FIND will report the name of each file it scans and will 
  31. display any line containing the pattern "putc".  It is not 
  32. sensitive to case; lines containing "putc", "Putc" and "PUTC" 
  33. will be displayed, as will lines containing "putch", "fputc" 
  34. and so on.
  35. ~
  36. You can tell FIND to search for more than one thing at a time.  
  37. For example, you might want to find all references to BDOS and 
  38. BIOS in a group of assembly-language files.  You could use the 
  39. command:
  40.  
  41.                find *.a?m [bios|bdos]
  42.  
  43. Note the | character used to separate alternative patterns and 
  44. the brackets used to enclose them.  Another way to do the same 
  45. thing would be:
  46.  
  47.                find *.a?m b[i|d]os
  48.  
  49. which says "look for a 'b' followed by an 'i' or a 'd' 
  50. followed in turn by 'os'.
  51. ~
  52. FIND recognises certain meta-characters in search patterns.  A 
  53. question mark in a pattern matches any character in the text 
  54. of a file.  The commands
  55.  
  56.         find *.a?m b?os    and     find *.a?m b[i|d]os
  57.  
  58. are similar;  the second restricts matching to the strings 
  59. "bios" and "bdos" in the text whereas the first would also 
  60. report lines containing things like "Ambrosia" and "caboose".
  61.  
  62. The meta-characters recognised by FIND are:
  63.  
  64.      ?    any character
  65.      @    any alphanumeric
  66.      _    tab  (the '_' is an underscore)
  67. ~
  68. Finally, things within a search pattern can be enclosed in 
  69. braces.  This tells FIND to match zero or more occurrences of 
  70. the {pattern} in the text.  For example,
  71.  
  72.           find *.doc 1{0}.
  73.  
  74. would match lines containing a 1 followed by any number of 
  75. zeros followed by a decimal point.  You may recall the example 
  76. at the beginning of these notes contained the following within 
  77. the search pattern:
  78.  
  79.                          ({?})
  80.  
  81. which means "a left parenthesis followed by any number of 
  82. arbitrary characters followed by a right parenthesis".
  83. ~
  84. You can get pretty clever at specifying search patterns but 
  85. there are some simple rules which are worth noting.
  86.  
  87. 1.   It is faster to search for more than one thing at a time 
  88.      than to do multiple searches.
  89.  
  90. 2.   If you are not really sure what you are looking for then 
  91.      err on the side of ambiguity.  You may get a lot of 
  92.      spurios lines displayed but at least you get the ones in 
  93.      which you are interested, e.g. "ms{-}dos" rather than 
  94.      "msdos" or "ms-dos".
  95.  
  96. 3.   Keep the search patterns as short as possible.  It speeds 
  97.      up the search, e.g. "fri" rather than "friday".
  98. ~
  99. At any time a Control-C terminates the program.  When scanning 
  100. multiple files pressing any other key skips to the next file 
  101. (if any).
  102.  
  103. If you use the FIND command with no parameters then you get a 
  104. screenful of information which is a highly abbreviated form of 
  105. these notes.
  106.  
  107. These notes were prepared by
  108.  
  109.      John Hastwell-Batten,
  110.      SYSOP, Tesseract RCPM+,
  111.      P.O. Box 242,
  112.      Dural, NSW 2158,
  113.      Australia.
  114.