Search and Replace - A script by D.G. Sureau Free open-source - May 1 2000
This program searches and (optionaly) replaces either an
identifier or a string, in a file, or in a set of files.
Regular expressions are not allowed.
This searches texts in a file, or in a set of files
matching a pattern.
The pattern may contain wilcards which are those of MS-DOS
and Unix: * and ?
The search can be performed case-sensitive or not.
One can search for identifiers in source,
or any string in any ASCII text.
By changing the "delimiters" string in the source, one can
change definition of what is identifier.
The current setting doesn't include "#" among delimiters.
The syntax is:
search [options] searching [replacing] filename
1) Filename may contain wildcards, example:
*.c
name.*
name?.py
2) If the replacing text is omitted, a simple search is performed.
3) Options are those:
-i case-insensitive for searched identifier.
-f case-insensitive for filename. Defaults are case-sensitive.
-t search for string. The default is search for identifier.
The string may contain space. In this case it has to
be inclosed inside "". Space is a delimiter, therefore
identifiers always are single words.
-d don't display when replacing. Default is display.
4) Multiple options are packed into a single string as:
-iftd
Removing strings from a text file may be performed by replacing
them by a blank space. Example:
search -ft "searched" " " filename