Section 10.4. Group Summary of sed Commands


10.4. Group Summary of sed Commands

In the lists that follow, 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. Commands marked with a | are specific to GNU sed.

10.4.1. Basic Editing

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).


10.4.2. Line Information

Command

Action

=

Display line number of a line.

l

Display control characters in ASCII.

p

Display the line.


10.4.3. Input/Output Processing

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.


10.4.4. Yanking and Putting

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.


10.4.5. Branching Commands

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.

:label

Label branched to by t or b.


10.4.6. Multiline Input Processing

Command

Action

N

Read another line of input (creates embedded newline).

D

Delete up to the embedded newline.

P

Print up to the embedded newline.




Linux in a Nutshell
Linux in a Nutshell
ISBN: 0596154488
EAN: 2147483647
Year: 2004
Pages: 147

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net