Book HomeBook TitleSearch this book

10.4. Group Summary of sed Commands

In the lists below, the sed commands are grouped by function and are described tersely. Full descriptions, including syntax and examples, can be found afterward in the "Alphabetical Summary" section.

10.4.1. Basic Editing

a\Append text after a line.
c\Replace text (usually a text block).
i\Insert text before a line.
dDelete lines.
sMake substitutions.
yTranslate characters (like Unix tr).

10.4.2. Line Information

=Display line number of a line.
lDisplay control characters in ASCII.
pDisplay the line.

10.4.3. Input/Output Processing

nSkip current line and go to line below.
rRead another file's contents into the output stream.
wWrite input lines to another file.
qQuit the sed script (no further output).

10.4.4. Yanking and Putting

hCopy into hold space; wipe out what's there.
HCopy into hold space; append to what's there.
gGet the hold space back; wipe out the destination line.
GGet the hold space back; append to the pattern space.
xExchange contents of hold space and pattern space.

10.4.5. Branching Commands

bBranch to label or to end of script.
tSame as b, but branch only after substitution.
:labelLabel branched to by t or b.

10.4.6. Multiline Input Processing

NRead another line of input (creates embedded newline).
DDelete up to the embedded newline.
PPrint up to the embedded newline.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.