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.

10.4.1 Basic Editing

a\Append text after a line.
c\Replace text (usually a text block).
i\Insert text after a line.
dDelete lines.
sMake substitutions.
yTranslate characters (like a 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 input.
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 on line below.
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 Multi-line 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