files] sed [
options] -e '
command1' [-e '
files] sed [
The first form invokes sed with a
command1. The second form
invokes sed with two (or more) commands. Note
that in this case the -e parameter is
required for each command specified. The commands are specified in
quotes to prevent the shell from interpreting and expanding them.
The last form instructs sed to take editing
commands from file
script (which does
not need to be executable). In all cases, if
files are not specified, input is taken
from standard input. If multiple
are specified, the edited output of each successive file is
Frequently used options
The -e option specifies that the next argument (
cmd) is a sed command (or a series of commands). When specifying only one string of commands, the -e is optional.
fileis a sed script.
Treat all substitutions as global.
The sed utility operates on text through the use of addresses and editing commands. The address is used to locate lines of text to be operated on, and editing commands modify text. During operation, each line (that is, text separated by newline characters) of input to sed is processed individually and without regard to adjacent lines. If multiple editing commands are to be used (through the use of a script file or multiple -e options), they are all applied in order to each line before moving on to the next line.
Addresses in ...