Search and Replace Utility
The FFSR program is a simple search and replace utility which may be helpful to make changes in for example a number of infobox files in a single operation.
The command-line parameters are used as follows:
|option||one or more of the following switches (multiple switch letters may follow -)|
|-c||use a case-blind comparison of the search string|
|-b||write a backup of each changed file (with file extension .~ext)|
|-r||recurse through subfolders|
|-f||list files containing searchstring to the console, no replacestring must be supplied (suppresses -v)|
|-n||make no changes (implies -v)|
|-v||write a verbose report of changes to the console|
|searchstring||a string to be found or replaced, enclosed in double quotes if it contains embedded space. To search for or replace a string containing double-quote characters, place two double-quote characters in the double-quoted string.|
|replacestring||a string to replace the found string, enclosed in double quotes if it contains embedded space. To insert a string containing double-quote characters, place two double-quote characters in the double-quoted string. Omit this parameter entirely when using the -f option, to avoid it being interpreted as a filename to be searched.|
|changelist||If you supply a changelist, it should consist of lines each consisting of a searchstring and a replacestring value, separated by a TAB character. Do not include quotes in these values unless you require them as part of the string. When using the -f option, omit the TAB and the replacestring and include only search strings in the changelist. CopiaFacts standard folder variables are not expanded in the pathname of the change list, because of the potential confusion with the standard variable expansion character @ which identifies this parameter.|
|textfile||The file name(s) to be searched. You may include wildcard characters * and ? in the filename and in path elements, but not in the machine name or sharename element of a UNC filename. You may include a list of files by using the syntax `listfile, where listfile is a file containing filenames or pathames, one per line. CopiaFacts standard folder variables such as @FFBASE are expanded in all filenames, including in the name of the listfile, if used.|
FFSR can handle files encoded UTF-8, Unicode, or system default encoding. The same encoding is retained in the modified file, even if this is not the encoding specified for writing the file type on a $unicode command.
The report from the -v verbose switch, and the file list generated from the -f switch, are written to the console standard output file. Any errors in the command or in reading or writing files are reported to the console standard error file.
These examples should be adapted to use the paths and names on your own system.
|Run each operation first with the -n command-line switch to check what changes would be made.|
List file names of files containing occurrences of a specific machine name in CopiaFacts command files:
FFSR -fr \\MACHINE *.CFG *.USR *.MBX | MORE
Change explicit machine name paths in MBX files to use a folder variable:
FFSR "\\server\copia\faxfacts" "@FFBASE" \\server\copia\faxfacts\mail\*.MBX
Remove drive letters:
FFSR -r Q: \\SERVER\COPIA \\SERVER\COPIA\FAXFACTS\*.USR