UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 10.3 Syntax of sed CommandsChapter 10
The sed Editor
Next: 10.5 Alphabetical Summary of sed Commands
 

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.


Previous: 10.3 Syntax of sed CommandsUNIX in a Nutshell: System V EditionNext: 10.5 Alphabetical Summary of sed Commands
10.3 Syntax of sed CommandsBook Index10.5 Alphabetical Summary of sed Commands

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System