MPE/iX Shell and Utilities Reference Manual, Vol 2
sed(1) MPE/iX Shell and Utilities sed(1)
NAME
sed — stream editor (non-interactive)
SYNOPSIS
sed [–En][script][file ...]
sed [–En][–e script] ... [–f scriptfile] ... [file ...]
DESCRIPTION
The sed command applies a set of editing commands contained in script to each input file.If
you did not specify a file, sed reads the standard input.
sed reads each input line into a special area known as the pattern buffer. Certain commands
[gGhHx] use a second area called the hold buffer. By default, after each pass through the
script, sed writes the final contents of the pattern buffer to the standard output.
Options
sed accepts the following options:
–E uses extended regular expressions. Normally, sed uses Basic regular expressions.
For more information, see regexp(3).
–e script
adds the argument script to the end of the script.
–f scriptfile
adds the commands in the file scriptfile (one command per line) to the script.
–n suppresses all output except that generated by explicit commands in the sed script
[acilnpPr]
If you have need of only one script argument, you may omit the –e and use the first form of
the command.
Commands
sed commands are similar to those of the interactive text editor ed, except that sed com-
mands necessarily view the input text as a stream rather than a directly addressable file.
Script commands can begin with zero, one, or two addresses, as in ed. Zero-address com-
mands reference every input line. One-address commands select only those lines matching
that address. Two-address commands select those input line ranges commencing with a match
on the first address up to an input line matching the second address, inclusive. Permissible
addressing constructions are:
n The number n matches only the nth input line.
1-506 Commands and Utilities