home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / varie / change / change.doc < prev    next >
Text File  |  2000-01-07  |  10KB  |  238 lines

  1. This program gives you the ability to search for different strings in files
  2. and to replace them with other string. The file could be binary or ascii.
  3. An example is if you change your harddisk and then most of the old path
  4. names also change. Normally you have to do this file for file by hand. With
  5. change it's much more easier! Only use change in a script with all (or all
  6. needed) files and the replacement is done.
  7.  
  8. Change is programmed with MaxonC++ and later SAS-C (but mostly in C and
  9. not C++) and it's Public Domain. I give all rights of the program to the
  10. user, but the same way I give no guarantee that the program works well.
  11. Use it of your own risk!
  12.  
  13. Since version 2.0 Change has a GUI. The elements of the GUI are the same
  14. like the Shell arguments! You can start Change with GUI from WB or from
  15. Shell without arguments. If you give arguments in the shell, Change will
  16. work with this arguments without opening a window!
  17.  
  18. The program requires OS2.0 (V37) or any later version.
  19.  
  20. The history of the program is in the source code -> source/Change/Change.c
  21.  
  22. If you call Change with ?(»Change ?«) you get the following argument list:
  23.  
  24. FROM/A,SSTRING,TO,RSTRING,FOUND/S,HEX/S,LENGTH/S,NOCHANGE/S,NOSIZE/S,
  25. OVERWRITE/S,PATH/S,POS=POSITION/K,SFILE/K,RFILE/K:
  26.  
  27. Enter again a ? and you will get a better explanation.
  28.  
  29. With »Version Change FULL« you get the actual version of this program.
  30. Thats useful for updating.
  31.  
  32. Explanation of arguments:
  33. FROM        the already existing file Change should work with
  34.         Starting with 2.33 Change allows use of patterns in file
  35.         names. See below for comments.
  36.         > needed every time !
  37. SSTRING        is the string Change should search for
  38.                 > needed every time, see SFILE also !
  39. TO        the file Change should write to
  40.         if it's the same like FROM (or their is no TO) it will be
  41.         overwritten! (only if there is enough memory to load it,
  42.         else the name will get _ at the end)
  43.                 > needed every time (not with option NOCHANGE)
  44. RSTRING        is the replacement for SSTRING
  45.                 > not needed, if not given an empty string is used, see
  46.                 RFILE also
  47. FOUND           gives you  every tim SSTRING is found or changed a output
  48.         (for example: String found at 32C). The number is the hexa-
  49.         decimal code of the position.
  50.                 > not needed, of no use with NOCHANGE
  51. HEX             gives you the posibility to enter the strings as hex
  52.         numbers. (Some chars can't be entered with the keyboard -
  53.         RETURN - 0A for example)
  54.                 > not needed
  55. LENGTH          changes the length information of a BCPL string (first
  56.         character contains length of string)
  57.                 > not needed, of no use with NOCHANGE and same length of
  58.                 of the strings, idiotic with a normal C-string (with 0 at
  59.                 end)
  60. NOCHANGE        turn of the replacement, only search SSTRING like Search
  61.         command in C:, Option FOUND automatical turned on
  62.         > not needed, Options TO, LENGTH, OVERWRITE, PATH, RSTRING
  63.         not useable
  64. NOSIZE          scan case insensitiv
  65.                 > not needed
  66. OVERWRITE       If RSTRING is longer than SSTRING the chars after RSSTRING
  67.         will be replaced, if RSTRING is shorter, the rest will be
  68.         filled with 0. This option is useful if you change strings
  69.         in executable filles, because the length can't be changed
  70.         May produce too long files, when RSTRING is larger than
  71.         SSTRING and replacement is near the fileend.
  72.                 > not needed, of no use with same length of the strings
  73.                 > turned off, when PATH is active
  74. PATH            Option to replace path names. It's like overwrite, but the
  75.         filling or overwriting starts first, when a 0 is found after
  76.         the replacement!
  77.         May produce too long files, when RSTRING is larger than
  78.         SSTRING and replacement is near the fileend.
  79.                 > turns off OVERWRITE, useless with same length of strings
  80. ALL        deep scanning in directories
  81.         > not needed
  82. POS             see POSITION
  83. POSITION        After POSITION you have to give a hex number of the position
  84.         you want to change sstring. If there is no sstring at this
  85.         position no replacement would be done. A position you can
  86.         get before that with the option NOCHANGE
  87.                 > not needed, of no use with NOCHANGE
  88. SFILE        Instead of giving SSTRING, you may save the texts to a file
  89.         and give the name with SFILE. You need to specify SFILE
  90.         keyword in command line!
  91. RFILE        Instead of giving RSTRING, you may save the texts to a file
  92.         and give the name with RFILE. You need to specify RFILE
  93.         keyword in command line!
  94.  
  95.  
  96. If you give no keywords, the first string is FROM, the second SSTRING, the
  97. third TO and the fourth RSTRING.
  98.  
  99. If SFILE is used and SSTRING is specified, but no TO file, then SSTRING is
  100. used as TO! Else TO would need to be specified as keyword always.
  101. Example:
  102.   Change file1 SFILE files file2
  103. is in real
  104.   Change FROM file1 SFILE files SSTRING file2
  105. but will be interpreted as
  106.   Change FROM file1 SFILE files TO file2
  107. which is more likely the thing you wanted.
  108.  
  109. If using RFILE or SFILE Option, specify FROM, TO, SSTRING, RSTRING keywords
  110. in front of the related texts always to prevent errors.
  111.  
  112. File-Patterns: Change supports the usage of file patterns. When multiple
  113. input files are found, the destination must be a directory. So there can
  114. be different cases:
  115. 1) Only one source and destination file
  116.    - Change works from source to destination
  117. 2) One source file and destination directory
  118.    - Change stores the destination file with source name in destination
  119.      directory.
  120. 3) Multiple source and destination directory
  121.    - Change stores the files (with ALL paramter also files from sub
  122.      directories) in destination with their source name.
  123. 4) Multiple source files and one destination name
  124.    - Change processes first file and brings an error for next one.
  125. 5) No destination given
  126.    - Change replaces the file(s).
  127.  
  128. With parameters NOCHANGE and POSITION, Change may find more positions than
  129. can be replaced by a normal pass. This is because these options display
  130. overlapping areas as well. In Change pass this is not possible.
  131.  
  132. Change also works with a pattern. If there is a \? in the text (or a ? in
  133. HEX mode) at this position every char will be accepted!
  134. Important:
  135.     \? is the pattern
  136.     \\ means one \
  137.     \  and after this a hex number with 2 digits means the char given
  138.     through the ascii-code(f.i. \57 is a W)
  139.         
  140. (see the examples)
  141. If you enter strings with HEX option all chars of no use are ignored. Only
  142. (0..9 a..f A..F ?) will be recognized. This means you can enter slashes
  143. between the chars to make it better visible.
  144. 123a4b52349f009a is the same as 123a_4b52_349f_009a or 123a.4b52.349f.009a
  145. or 1-2-3-a-4-b-5-2-3-4-9-f-0-0-9-a.
  146.  
  147. At the program start Change tells you the two strings it works with.
  148. Chars from 20 to 7E and from A1 to FF will be shown like given. 
  149. . means a non printable char and
  150. _ means a pattern.
  151.  
  152. At the end the program gives you a status report of the done work:
  153. String ... times found and ... times changed
  154.  
  155. Examples:
  156. You want to search in the file SYS:Texts/S the name Intel:
  157. --> Change SYS:Texts/S Intel NOCHANGE
  158.  
  159. With hex option it looks like this:
  160. --> Change SYS:Texts/S 496E74_656C NOCHANGE HEX
  161.  
  162. If you want to change Intel to Motorola you must give me a destination
  163. (SYS:Texts/S2) and remove NOCHANGE:
  164. --> Change SYS:Texts/S Intel SYS:Texts/S2 Motorola
  165.  
  166. With NOSIZE  you can also scan for intel, InTeL, INTEL and other forms,
  167. FOUND shows you the position of the string:
  168. --> Change SYS:Texts/S Intel SYS:Texts/S2 Motorola NOSIZE FOUND
  169.  
  170. Use the CD command before that, so the arguments will be shorter
  171. Befehl:
  172. --> CD SYS:Texts
  173.     Change S Intel S2 Motorola NOSIZE FOUND
  174.  
  175. If you want to replace wrong written word MoToRoLa or motorola with the 
  176. capitalized version Motorola, use this (remember NOSIZE doesn't change the
  177. destination string):
  178. --> Change S motorola S2 Motorola NOSIZE
  179.  
  180. If Intel should be replaced only at one position so use POSITION:
  181. --> Change S Intel S2 Motorola POSITION D3 NOSIZE
  182.  
  183. Alternativly use POS:
  184. --> Change S Intel S2 Motorola POS D3 NOSIZE
  185.  
  186. If the strings contain spaces use "":
  187. --> Change S "Intel is good" S2 "Motorola is better"
  188.  
  189. You can also delete the SSTRING in the file:
  190. --> Change S Intel S2 ""            or
  191. --> Change S Intel S2
  192.  
  193. If you want to replace words, which don't differ very much (Disk and Disc
  194. with floppy disc) so use a Pattern:
  195. --> Change S Dis\? S2 "floppy disc"
  196.  
  197. or
  198.  
  199. --> Change S 446973? S2 666C6F707079_64697363 HEX
  200.  
  201. If you want to search for a \ so enter they every time twice. (6 instead
  202. of 3 ...)
  203. --> Change S \\ S2 /            --> changes \ to /
  204.  
  205. --> Change S \\\\ S2 //         --> changes \\ to //
  206.  
  207. --> Change S \\? S2 /?          --> changes \? to /? (no pattern !)
  208.  
  209. but rememeber:
  210.  
  211. --> Change S \? S2 /?           --> changes every char to /?
  212.  
  213. If SSTRING is "" an error appears.
  214.  
  215. Plans for the future:
  216.  
  217. The pattern * for a variable number of chars or the standard Amiga patterns,
  218. like #, ~, ().
  219. Localisation and together with this german texts (The OS errors are already
  220. localized by the OS!).
  221.  
  222. This program is in the public domain. Use it as you want, but WITHOUT ANY
  223. WARRANTY!
  224.  
  225. Comments, wishes, money (it is Public Domain, but why not), greetings and
  226. bug reports to
  227.  
  228. ************************************************************************
  229. * snail-mail:                  * e-mail:                               *
  230. *   Dirk Stoecker              *   stoecker@amigaworld.com             *
  231. *   Geschwister-Scholl-Str. 10 *   dstoecker@gmx.de                    *
  232. *   01877 Bischofswerda        * world wide web:                       *
  233. *   GERMANY                    *   http://home.pages.de/~Gremlin/      *
  234. * phone:                       * pgp key:                              *
  235. *   GERMANY +49 (0)3594/706666 *   get with finger or from WWW pages   *
  236. ************************************************************************
  237.  
  238.