
760
|
Chapter 10: The sed Editor
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Branching Commands
Multiline Input Processing
Alphabetical Summary of sed Commands
GNU sed lets you use the filenames /dev/stdin, /dev/stdout and /dev/stderr to refer
to standard input, output, and error, respectively, for the r, R, w, and W
commands and the w flag to the s command.
GNU-specific commands or extensions are noted with {G} in the command
synopsis. When the GNU version allows a command to have two addresses, the
command is performed for each input line within the range.
#
#
Begin a comment in a sed script. Valid only as the first character of
the first line. (Some versions, including GNU sed, allow comments
anywhere, but it is better not to rely on this.) If the first line of the
script is #n, sed behaves as if -n had been specified.
:
:label
Label a line in the script for the transfer of control by b or t.
According to POSIX, sed must support labels that are unique in the
first eight characters. GNU sed has no limit, but some older
versions support up to only seven characters.
=
[/pattern/]=
[address1[,address2]]= {G}
Write to standard output the line number of each line addressed by
pattern.
Command Action
b Branch to label or to end of script.
t Same as b, but branch only after substitution.
T† Same as t, but branch only if no successful substitutions. ...