home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / strings / gr / gr.doc < prev    next >
Encoding:
Text File  |  1989-02-08  |  4.2 KB  |  116 lines

  1.  
  2. GR - General Replace
  3.  
  4. This program replaces text substrings in the input file based on
  5. specifications in a "token file".  While any text editor or word processor
  6. can replace text, the advantage of GR is that up to 100 replacements can be
  7. done on one pass over the text.  While AWK can to the same thing, GR is 
  8. easier to use and much faster.
  9.  
  10. GR COMMAND LINE
  11. ---------------
  12.  
  13. The call to GR is:
  14.  
  15.          GR  inputfile  outputfile   tokenfile
  16.  
  17. All fields are required and GR will error if there are less than 3 fields.
  18. The images in the tokenfile are read and parsed.  Then, the text lines are
  19. read from the inputfile, processed and written to the outputfile.
  20.  
  21. The inputfile and outputfile should not be the same file.  If they are, the
  22. results can range from strange to disastrous.
  23.  
  24. TOKENFILE FORMAT
  25. ----------------
  26.  
  27. Images in the tokenfile are in the format:
  28.  
  29.             searchstring=replacestring
  30.  
  31. for example
  32.  
  33.              \xx=This string replaces xx
  34.  
  35. Any leading or trailing spaces are significant.  Any spaces on either side
  36. of the = sign are also significant.  This means that
  37.  
  38.               \xx = This string replaces xx
  39.  
  40. is different than
  41.  
  42.                \xx=This string replaces xx
  43.  
  44. The images in the token file are applied against each line of the input file
  45. in the order they appear in the tokenfile.  This means that
  46.  
  47.         \t=A short string
  48.         \tb=A replacement string
  49.  
  50. will not have the results you might expect.  It should appear in the token
  51. file as:
  52.  
  53.         \tb=A replacement string
  54.         \t=A short string
  55.  
  56. This order of evaluation also means that replacements can be "nested", for
  57. example
  58.  
  59.           \xx=This string will have \tt replaced by a subsequent definition
  60.           \tt=This replaces part of the replaced string above
  61.           \ss=The \xx in this string will NOT be replaced by the above
  62.  
  63. THE GRR PROGRAM
  64.  
  65. No, this is not for frustrated programs to express their feelings!  This 
  66. program is intended to REVERSE the effects of GR.  It reads the same "token" 
  67. file as GR, but replaces "replacestring" (see above) with "searchstring".  
  68. It also processes the definitions in the tokenfile in REVERSE order.  All of 
  69. this is an attempt to restore the text to its original state, which could be 
  70. handy if it has been edited since conversion.  GRR does its best; however, 
  71. since the process does not involve any artificial intelligence, GRR may not 
  72. restore the text to its EXACT original state. In fact, it could fail 
  73. miserably if the conversion was complex.  Always inspect the REVERSEd file 
  74. after GRR is done.
  75.  
  76. Example:
  77.  
  78.              GR  infile outfile deffile    /* Convert originally */
  79.              < Other stuff goes on here >
  80.              < or nothing goes on here  >
  81.              GRR outfile anotherfile deffile  /* Attempt reverse conversion */
  82.              
  83.  
  84. MAINTENANCE HISTORY
  85.  
  86. Level 1R1A - The original GR and GRR are case-insensitive, which may not be
  87.              desirable for all uses, also it can cause problems when the
  88.              string to be replaced duplicates the replacement string except
  89.              for case.  Therefore, you will now find two versions of GR,
  90.              etal.  GR and GRR are the case-SENSITIVE versions and GRI and
  91.              GRRI are the case-INSENSITIVE versions.
  92.  
  93.             
  94. THE USUAL STUFF
  95.  
  96. If you like this program, a registration of $5 would be appreciated.  All
  97. persons who register will be notified of any updates to this program and of
  98. the availability of other programs produced by The Lone Consultant.
  99.  
  100.                         The Lone Consultant
  101.                         996 Burns Ave.
  102.                         St. Paul, MN  55106
  103.  
  104.  
  105. The Lone Consultant disclaims all warranties, either express or implied, 
  106. including but not limited to any implied warranty of merchantability or 
  107. fitness for any particular purpose.
  108.  
  109. In no event will The Lone Consultant be liable for any damages whatsoever 
  110. (including without limitation damages for loss of business profits, business 
  111. interruption, loss of business information or the like) arising out of the 
  112. use of, interruption in the use of, or inability to use this software, even 
  113. if The Lone Consultant has been advised of any possibility or likelihood of 
  114. such damages.
  115.  
  116.