SYNOPSIS
gres pattern substitution [file ...]
DESCRIPTION
gres reads input from each argument file and looks for all lines matching pattern. The pattern is an extended regular expression. See regexp for further information. For each input line matched, gres replaces all occurrences of matching strings with the replacement string substitution. It then writes its results to the standard output.
If you do not specify any files on the command line, gres reads the standard input.
As is the case for the substitution command in the ed text editor, the substitution string may contain the following shorthand notations:
- &
-
The character & in the substitution string is replaced by the entire string that matched the regular expression pattern.
- \0
-
This notation is identical in meaning to &.
- \d
-
The number d must be a single digit between 1 and 9. If the pattern contains any portions enclosed by the () characters, the string \d is replaced by the text matched by the dth parenthesized portion of pattern. Parenthesized expressions are numbered by counting ( characters from the left.
To circumvent the special meaning of any of these characters, put \ in front of the special character. For example, to substitute a \ character, type \\.
EXAMPLES
This is a filter to switch political allegiance:
gres 'democrat(ic)?' republican
DIAGNOSTICS
Possible exit status values are:
- 0
-
gres found at least one match for pattern and made the desired substitution.
- 1
-
gres found no matches for pattern.
- 2
-
Failure due to any of the following:
PORTABILITY
Windows 2000. Windows XP. Windows Server 2003. Windows Vista.
This is really a simple subset of the sed command.
AVAILABILITY
MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Miscellaneous:
- regexp
MKS Toolkit 9.2 Documentation Build 16.