Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

User Commands (s) sed(1)
next input line. If read_le does not exist, it is treated as an empty le, causing no
error condition.
(2)s/pattern/replacement/flags
Substitutes the replacement string for the rst occurrence of the pattern in the pattern
space. Any character that is entered after the s command can substitute for the / (slash)
separator, except \ (backslash) and the newline character. Within the regular expres-
sion and replacement string, the delimiter can appear as a literal if it is preceded by a \
(backslash).
An & (ampersand) appearing in the replacement string is replaced by the string match-
ing the RE. The special meaning of & in this context can be suppressed by preceding
it with a \ (backslash). The characters \n, where n is a digit, are replaced by the text
matched by the corresponding backreference expression.
A line can be split by substituting a newline character into it. You must escape the
newline character in the replacement string by preceding it with a \ backslash. A sub-
stitution is considered to have been performed even if the replacement string is identi-
cal to the string that it replaces.
You can add zero or more of the following ags:
n Substitutes replacement for the nth occurrence of pattern on each addressed
line, rather than for the rst occurrence.
g Substitutes replacement for all nonoverlapping instances of pattern on each
addressed line, rather than for just the rst one (or for the one specied by n).
p Writes the pattern space to standard output if a replacement was made.
w write_file
Writes the pattern space to write_le if a replacement was made. Appends
the pattern space to write_le.Ifwrite_le was not already created by a pre-
vious write by this sed script, sed creates it. Each write_le is created before
processing begins.
(2)t [label]
Branches to :label in the script le if any substitutions were made since the most recent
reading of an input line or execution of a t subcommand. If you do not specify label,
control transfers to the end of the script.
(2)w write_file
Appends the pattern space to write_le.
(2)x Exchanges the contents of the pattern space and the hold space.
(2)y/pattern1/pattern2/
Replaces all occurrences of characters in pattern1 with the corresponding characters
from pattern2. pattern1 and pattern2 must contain the same number of characters. The
delimiter itself can be used as a literal if it is preceded by a \ (backslash) character.
(2)!sed_command
Applies the specied sed subcommand only to lines not selected by this address or
addresses.
(2)!{subcommand ...
} Applies the specied subcommand list only to lines not selected by this address or
addresses. The { (left brace) can be preceded by spaces and can be followed by spaces
527188-003 Hewlett-Packard Company 85