10.4. Group Summary of sed Commands

 < Day Day Up > 

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 in the following section, "Alphabetical Summary." Commands marked with a | are specific to GNU sed.

10.4.1. Basic Editing

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

=

Display line number of a line.

l

Display control characters in ASCII.

p

Display the line.


10.4.3. Input/Output Processing

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

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

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

N

Read another line of input (creates embedded newline).

D

Delete up to the embedded newline.

P

Print up to the embedded newline.


     < Day Day Up > 


    Unix in a Nutshell
    Unix in a Nutshell, Fourth Edition
    ISBN: 0596100299
    EAN: 2147483647
    Year: 2005
    Pages: 201

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