MPE/iX Shell and Utilities Reference Manual, Vol 2
sed(1) MPE/iX Shell and Utilities sed(1)
p executes the print (p) command only if a successful substitution occurs.
w file writes the contents of the pattern buffer to the end of file, if a substitution
occurs.
a,bt [label]
branches to the indicated label if any successful substitution has occurred since
either reading the last input line or executing the last t command. If you do not spec-
ify label, sed branches to the end of the script.
a,bw file
writes the text in the pattern buffer to the end of file.
a,bx exchanges the text in the hold buffer with that in the pattern buffer.
a,by/set1/set2/
transliterates any input character occurring in set1 to the corresponding element of
set2. The sets must be the same length. You can use any character other than
backslash or newline instead of the slash, to delimit the strings.
a,b{ groups all commands until the next matching } command, so that sed executes the
entire group only if the { command is selected by its address(es).
: label designates a label which can be the destination of a b or t command.
a,b!cmd
executes the specified cmd only if the addresses do not select the ! command.
# treats the script line as a comment unless it is the first line in the script. If the first
line in a script is #n, it is equivalent to specifying –n on the command line. Any
empty script line is also treated as a comment.
a= writes the decimal value of the current line number onto the standard output.
EXAMPLES
Here is a filter to switch political allegiance:
sed ’s/democrat\(ic\)*/republican/g’
ENVIRONMENT VARIABLES
sed used the following environment variable:
COLUMNS
contains the width of the screen in columns. If set, sed uses this value to fold long
lines on output; otherwise, sed uses the appropriate value from the terminal database
for the terminal in use and if that is not valid, it uses a default of 80.
Commands and Utilities 1-509