home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / zsus / z3help / f.lbr / FINREP.HZP / FINREP.HLP
Encoding:
Text File  |  1991-11-18  |  7.6 KB  |  164 lines

  1. ;
  2.                                  FINDREP
  3.  
  4.                         A -  Overview             
  5.                         B -  Command Line         
  6.                         C -  Switches and Options 
  7.                         D -  String Entry         
  8.                         E -  Miscellenous         
  9. :a
  10.                                    Overview 
  11.  
  12. FINDREP is a search/replace program that remedies some of the deficiencies of
  13. WordStar's ^QA and other similar commands.  Aside from being faster, it has a
  14. few additional features:
  15.  
  16. -    allows wildcard filename (find/replace in groups of files)
  17.  
  18. -    command-line entry allows batch processing by SUBMIT, etc.
  19.  
  20. -    allows entry of control or hex characters (0-FF)
  21.  
  22. -    can be used with object files (e.g., COM files)
  23.  
  24. -    sets capitalization (first letter or whole word) and high bit of the last
  25.      character according to the old string
  26.  
  27. This last feature means that, for example, if you are writing a scenario where
  28. the characters' names appear sometimes in CAPS and sometimes just Capitalized,
  29. you don't need two search/replaces to replace one name with another:  JOE will
  30. be replaced by HARRY, Joe by Harry, and even joe by harry.
  31. :b
  32.                                  Command Line 
  33.  
  34. Format:  findrep [d:]fn [newfn] /[switches]/ oldstring [newstring]
  35.  
  36.          (Enter "findrep" alone for a brief command summary.)
  37.  
  38. If a second filename is given, the changes will be placed in that file;  if
  39. not, the old filename will hold the changes and the original file will be
  40. changed from fn.ft to fn.BAK (unless the "B" switch is used).
  41.  
  42. Wildcards (*,?) may be used in the filename (NOT the filetype: thus blurk*.txt
  43. or *.txt is OK, but blurk.* or blurk.d?c is not). If wildcards are used, a
  44. second filename cannot be entered. Unless the "B" switch is used, FINDREP will
  45. create BAK files for all changed files, using the original filename.  Thus if
  46. you entered:
  47.  
  48.                       A>findrep urk*.doc // "blurk" "zap"
  49.  
  50. the files urk01.doc, urk33.doc, urktty.doc would be modified as expected and
  51. files urk01.bak, urk33.bak etc. would be created.
  52.  
  53. The characters "//" must be entered even if no switches are used.
  54. :c
  55.                              Switches and Options 
  56.  
  57. The switches are as follows:
  58.  
  59. B =  no BAK file.  This switch disables making a BAK file;  the original file
  60.      will be lost.  (Use only if you did not enter a second filename.)
  61.  
  62. C =  respect case.  This switch allows you to distinguish capital from lower-
  63.      case letters:  in a search for "the", "The" will not be found/replaced.
  64.      (NB:  Upper case letters cannot be entered within quotes.)
  65.  
  66. H =  keep High bit.  With this switch, all bytes are searched exactly as they
  67.      are;  letters with the high bit set will not be identified with their
  68.      standard ASCII counterparts.
  69.  
  70. O =  Object file.  If this switch is used, the program will ignore end-of-file
  71.      markers (1AH), as in PIP's "o" command.  Use for search/replace in non-
  72.      text files.
  73.  
  74. W =  no Whole-word search.  This switch is used to search a string whether or
  75.      not it is a whole word;  with it, a search for "the" will find "other",
  76.      "their" etc.
  77.                        Switches and Options (continued) 
  78.  
  79. Iε norma∞ operatioε (witΦ n∩ switches)¼ thσ searcΦ wil∞ includσ wholσ word≤ ì
  80. only╗  i⌠ wil∞ ignorσ casσ anΣ higΦ bits¼ bu⌠ wil∞ se⌠ thσ ne≈ strinτ t∩ ì
  81. corresponΣ t∩ thσ old¼ capitalizinτ thσ firs⌠ lette≥ o≥ thσ wholσ strinτ anΣ ì
  82. settinτ thσ higΦ bi⌠ oµ thσ las⌠ a≤ required«  Thi≤ las⌠ featurσ i≤ onl∙ ì
  83. usefu∞ iµ thσ replacemen⌠ strinτ i≤ onσ worΣ long╗  iµ i⌠ contain≤ morσ thaε ì
  84. onσ word¼ yo⌡ ma∙ se⌠ thσ higΦ bit≤ wheε yo⌡ ente≥ thσ string¼ o≥ le⌠ you≥ ì
  85. word-processo≥ (e.g«  WordStar⌐ d∩ it«  Iµ yo⌡ includσ capital≤ iε you≥ ì
  86. replacemen⌠ string¼ the∙ wil∞ bσ respecteΣ eveε iµ thσ finΣ strinτ i≤ no⌠ ì
  87. capitalized.
  88.  
  89. Iµ yo⌡ wan⌠ t∩ searcΦ fo≥ ß capitalizeΣ word¼ yo⌡ mus⌠ usσ thσ "Có switcΦ (o≥ ì
  90. thσ "Hó o≥ "Oó switch)╗  FINDRE╨ wil∞ givσ yo⌡ aε erro≥ messagσ iµ yo⌡ don't.
  91.  
  92. Thσ prograφ define≤ ß "wordó a≤ anythinτ precedeΣ anΣ followeΣ b∙ somethinτ ì
  93. othe≥ thaε ß lette≥ (space¼ punctuatioε mark¼ number¼ contro∞ character¼ ì
  94. beginninτ o≥ enΣ oµ file)«  Thu≤ thσ ╫ switcΦ i≤ no⌠ needeΣ iµ thσ searcΦ ì
  95. strinτ i≤ ß serie≤ oµ words¼ ß worΣ precedeΣ b∙ ß contro∞ characte≥ tha⌠ i≤ ì
  96. no⌠ continguou≤ t∩ anothe≥ word¼ etc.
  97. :d
  98.                                  String Entry 
  99.  
  100. The find and replace strings must be separated by a space from the switch entry
  101. and from each other.  Strings should be entered as follows:
  102.  
  103.      -    ASCII, in quotes:  "blurk", "54%**90er @"
  104.  
  105. The following characters must NOT be placed between quotes:
  106.  
  107.      -    HEX, separate by commas:  d,1A,cd,10,ff,3
  108.  
  109.      -    CAPITALS, preceded by "!":  !A,!h!e!l!l!o
  110.  
  111.      -    CONTROL CHARACTERS, preceded by "^":  ^M,^m^j,^c,^C
  112.  
  113. NB:  Al∞ ASCI╔ letter≤ entereΣ withiε quote≤ wil∞ bσ treateΣ a≤ LOWE╥ CASE«  ì
  114. áááááIµ yo⌡ wan⌠ t∩ searcΦ uppe≥ casσ letter≤ witΦ thσ "Có switch¼ o≥ t∩ pu⌠ ì
  115. áááááuppe≥ casσ letter≤ iε thσ replacσ string¼ yo⌡ mus⌠ precedσ EAC╚ b∙ "!"¼ ì
  116. áááááunles≤ yo⌡ ente≥ theφ a≤ he° characters║ (┴ ╜ 41¼ ┬ ╜ 4▓ ...)«  Sorr∙ ì
  117. áááááabou⌠ this¼ bu⌠ thσ CP/═ commanΣ linσ canno⌠ distinguisΦ uppe≥ froφ lowe≥ ì
  118. ááááácase.
  119.                            String Entry (continued) 
  120.  
  121. Any combination of characters is valid;  for clarity, groups should be
  122. separated by commas, although this is only necessary for individual hex
  123. characters:  !h"ello",^m^j,e5,32,"blurk",!q,^i Quotes must be closed.  To
  124. search/replace the quotation mark, enter it as a hex character (" = 22 hex).
  125.  
  126. The length of the find/replace strings is limited to 30 bytes;  this length
  127. applies to the strings themselves and not to the keyboard entry, which cannot
  128. exceed 127 bytes in all (blame CP/M for this).  Thus ^j,cd,ff,3d is 4 bytes
  129. long.
  130.  
  131. If you do not enter a replace string, the searched-for string will be replaced
  132. by nothing (i.e. deleted).
  133.  
  134. FINDREP can be aborted at any time by typing <ESC> (=1B HEX).  I preferred this
  135. to ^C since an extra ^C will be read by CP/M as a warm boot.
  136.  
  137. The only screen output is the number of strings replaced and, if you use
  138. wildcards, the names & total number of files processed. If you want to see the
  139. replacement procedure in action, use a word-processor!
  140. :e
  141.                                  Miscellenous 
  142.  
  143. 1.   FINDREP will modify files of any length;  it uses the entire memory below
  144.      the CCP as its buffer, and writes to disk whenever the buffer fills up.
  145.      Since it doesn't overwrite the CCP, it doesn't have to end with a warm
  146.      boot.
  147.  
  148. 2.   In deciding whether to capitalize a whole word/string, FINDREP looks at
  149.      the first two letters.  If the find string has only one letter, only the
  150.      first letter of the replacement string will be capitalized.  If the word
  151.      to be replaced has unusual captalization (e.g.  BBrrOOOmm), use the "C"
  152.      switch and/or enter separate replacement strings for different variants.
  153.  
  154. 3.   Re speed, FINDREP is somewhat faster than WordStar's ^QA command.  But if
  155.      all you want to do is replace a string, it is over three times faster,
  156.      since its time includes loading and saving the file.  Measured on a long
  157.      (84 K) file, FINDREP took 27 seconds and WS 34 for a typical
  158.      search/replace.  But WS needs at least 10 seconds to load and a good
  159.      minute to save the file and exit.  With a little practice, the command
  160.      line can be entered as fast as WS's, and it can be included in SUBMIT
  161.      files or reproduced by programs like ALIAS.
  162. orm loops than by using
  163. scripts, custom shells, and aliases.  A single command line can be used
  164. instead.  The syntax