home *** CD-ROM | disk | FTP | other *** search
- ;
- FINDREP
-
- A - Overview
- B - Command Line
- C - Switches and Options
- D - String Entry
- E - Miscellenous
- :a
- Overview
-
- FINDREP is a search/replace program that remedies some of the deficiencies of
- WordStar's ^QA and other similar commands. Aside from being faster, it has a
- few additional features:
-
- - allows wildcard filename (find/replace in groups of files)
-
- - command-line entry allows batch processing by SUBMIT, etc.
-
- - allows entry of control or hex characters (0-FF)
-
- - can be used with object files (e.g., COM files)
-
- - sets capitalization (first letter or whole word) and high bit of the last
- character according to the old string
-
- This last feature means that, for example, if you are writing a scenario where
- the characters' names appear sometimes in CAPS and sometimes just Capitalized,
- you don't need two search/replaces to replace one name with another: JOE will
- be replaced by HARRY, Joe by Harry, and even joe by harry.
- :b
- Command Line
-
- Format: findrep [d:]fn [newfn] /[switches]/ oldstring [newstring]
-
- (Enter "findrep" alone for a brief command summary.)
-
- If a second filename is given, the changes will be placed in that file; if
- not, the old filename will hold the changes and the original file will be
- changed from fn.ft to fn.BAK (unless the "B" switch is used).
-
- Wildcards (*,?) may be used in the filename (NOT the filetype: thus blurk*.txt
- or *.txt is OK, but blurk.* or blurk.d?c is not). If wildcards are used, a
- second filename cannot be entered. Unless the "B" switch is used, FINDREP will
- create BAK files for all changed files, using the original filename. Thus if
- you entered:
-
- A>findrep urk*.doc // "blurk" "zap"
-
- the files urk01.doc, urk33.doc, urktty.doc would be modified as expected and
- files urk01.bak, urk33.bak etc. would be created.
-
- The characters "//" must be entered even if no switches are used.
- :c
- Switches and Options
-
- The switches are as follows:
-
- B = no BAK file. This switch disables making a BAK file; the original file
- will be lost. (Use only if you did not enter a second filename.)
-
- C = respect case. This switch allows you to distinguish capital from lower-
- case letters: in a search for "the", "The" will not be found/replaced.
- (NB: Upper case letters cannot be entered within quotes.)
-
- H = keep High bit. With this switch, all bytes are searched exactly as they
- are; letters with the high bit set will not be identified with their
- standard ASCII counterparts.
-
- O = Object file. If this switch is used, the program will ignore end-of-file
- markers (1AH), as in PIP's "o" command. Use for search/replace in non-
- text files.
-
- W = no Whole-word search. This switch is used to search a string whether or
- not it is a whole word; with it, a search for "the" will find "other",
- "their" etc.
- Switches and Options (continued)
-
- Iε norma∞ operatioε (witΦ n∩ switches)¼ thσ searcΦ wil∞ includσ wholσ word≤ ì
- only╗ i⌠ wil∞ ignorσ casσ anΣ higΦ bits¼ bu⌠ wil∞ se⌠ thσ ne≈ strinτ t∩ ì
- corresponΣ t∩ thσ old¼ capitalizinτ thσ firs⌠ lette≥ o≥ thσ wholσ strinτ anΣ ì
- settinτ thσ higΦ bi⌠ oµ thσ las⌠ a≤ required« Thi≤ las⌠ featurσ i≤ onl∙ ì
- usefu∞ iµ thσ replacemen⌠ strinτ i≤ onσ worΣ long╗ iµ i⌠ contain≤ morσ thaε ì
- onσ word¼ yo⌡ ma∙ se⌠ thσ higΦ bit≤ wheε yo⌡ ente≥ thσ string¼ o≥ le⌠ you≥ ì
- word-processo≥ (e.g« WordStar⌐ d∩ it« Iµ yo⌡ includσ capital≤ iε you≥ ì
- replacemen⌠ string¼ the∙ wil∞ bσ respecteΣ eveε iµ thσ finΣ strinτ i≤ no⌠ ì
- capitalized.
-
- Iµ yo⌡ wan⌠ t∩ searcΦ fo≥ ß capitalizeΣ word¼ yo⌡ mus⌠ usσ thσ "Có switcΦ (o≥ ì
- thσ "Hó o≥ "Oó switch)╗ FINDRE╨ wil∞ givσ yo⌡ aε erro≥ messagσ iµ yo⌡ don't.
-
- Thσ prograφ define≤ ß "wordó a≤ anythinτ precedeΣ anΣ followeΣ b∙ somethinτ ì
- othe≥ thaε ß lette≥ (space¼ punctuatioε mark¼ number¼ contro∞ character¼ ì
- beginninτ o≥ enΣ oµ file)« Thu≤ thσ ╫ switcΦ i≤ no⌠ needeΣ iµ thσ searcΦ ì
- strinτ i≤ ß serie≤ oµ words¼ ß worΣ precedeΣ b∙ ß contro∞ characte≥ tha⌠ i≤ ì
- no⌠ continguou≤ t∩ anothe≥ word¼ etc.
- :d
- String Entry
-
- The find and replace strings must be separated by a space from the switch entry
- and from each other. Strings should be entered as follows:
-
- - ASCII, in quotes: "blurk", "54%**90er @"
-
- The following characters must NOT be placed between quotes:
-
- - HEX, separate by commas: d,1A,cd,10,ff,3
-
- - CAPITALS, preceded by "!": !A,!h!e!l!l!o
-
- - CONTROL CHARACTERS, preceded by "^": ^M,^m^j,^c,^C
-
- NB: Al∞ ASCI╔ letter≤ entereΣ withiε quote≤ wil∞ bσ treateΣ a≤ LOWE╥ CASE« ì
- áááááIµ yo⌡ wan⌠ t∩ searcΦ uppe≥ casσ letter≤ witΦ thσ "Có switch¼ o≥ t∩ pu⌠ ì
- áááááuppe≥ casσ letter≤ iε thσ replacσ string¼ yo⌡ mus⌠ precedσ EAC╚ b∙ "!"¼ ì
- áááááunles≤ yo⌡ ente≥ theφ a≤ he° characters║ (┴ ╜ 41¼ ┬ ╜ 4▓ ...)« Sorr∙ ì
- áááááabou⌠ this¼ bu⌠ thσ CP/═ commanΣ linσ canno⌠ distinguisΦ uppe≥ froφ lowe≥ ì
- ááááácase.
- String Entry (continued)
-
- Any combination of characters is valid; for clarity, groups should be
- separated by commas, although this is only necessary for individual hex
- characters: !h"ello",^m^j,e5,32,"blurk",!q,^i Quotes must be closed. To
- search/replace the quotation mark, enter it as a hex character (" = 22 hex).
-
- The length of the find/replace strings is limited to 30 bytes; this length
- applies to the strings themselves and not to the keyboard entry, which cannot
- exceed 127 bytes in all (blame CP/M for this). Thus ^j,cd,ff,3d is 4 bytes
- long.
-
- If you do not enter a replace string, the searched-for string will be replaced
- by nothing (i.e. deleted).
-
- FINDREP can be aborted at any time by typing <ESC> (=1B HEX). I preferred this
- to ^C since an extra ^C will be read by CP/M as a warm boot.
-
- The only screen output is the number of strings replaced and, if you use
- wildcards, the names & total number of files processed. If you want to see the
- replacement procedure in action, use a word-processor!
- :e
- Miscellenous
-
- 1. FINDREP will modify files of any length; it uses the entire memory below
- the CCP as its buffer, and writes to disk whenever the buffer fills up.
- Since it doesn't overwrite the CCP, it doesn't have to end with a warm
- boot.
-
- 2. In deciding whether to capitalize a whole word/string, FINDREP looks at
- the first two letters. If the find string has only one letter, only the
- first letter of the replacement string will be capitalized. If the word
- to be replaced has unusual captalization (e.g. BBrrOOOmm), use the "C"
- switch and/or enter separate replacement strings for different variants.
-
- 3. Re speed, FINDREP is somewhat faster than WordStar's ^QA command. But if
- all you want to do is replace a string, it is over three times faster,
- since its time includes loading and saving the file. Measured on a long
- (84 K) file, FINDREP took 27 seconds and WS 34 for a typical
- search/replace. But WS needs at least 10 seconds to load and a good
- minute to save the file and exit. With a little practice, the command
- line can be entered as fast as WS's, and it can be included in SUBMIT
- files or reproduced by programs like ALIAS.
- orm loops than by using
- scripts, custom shells, and aliases. A single command line can be used
- instead. The syntax