
Group Summary of sed Commands | 759
sed
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
afterward in the “Alphabetical Summary” section. Commands marked with a †
are specific to GNU sed.
Basic Editing
Line Information
Input/Output Processing
Yanking and Putting
Command Action
a\ Append text after a line.
c\ Replace text (usually a text block).
i\ Insert text before a line.
d Delete lines.
s Make substitutions.
y Translate characters (like Unix tr).
Command Action
= Display line number of a line.
l Display control characters in ASCII.
p Display the line.
Command Action
e† Execute commands.
n Skip current line and go to the next line.
r Read another file’s contents into the output stream.
R† Read one line from a file into the output.
w Write input lines to another file.
W† Write first line in pattern space to another file.
q Quit the sed script (no further output).
Q† Quit without printing the pattern space.
v† Require a specific version of GNU sed to run the script.
Command Action
h Copy into hold space; wipe out what’s there.
H Copy into hold space; append to what’s there.
g Get the hold space back; wipe out the destination line.
G Get the hold space back; append to the pattern space.
x Exchange contents of the hold and pattern spaces.