Roopak Vasa
Roopak Vasa

Reputation: 127

What does the comma in sed commands stand for?

What does the following command mean:

sed -e '/SUBCKT\ REDBK128S4_LC/,/ENDS/ d'   $1 

What does , stand for?

Upvotes: 12

Views: 10481

Answers (2)

Mark Setchell
Mark Setchell

Reputation: 207560

It specifies a RANGE over which to apply the d command.

Ranges can be specified with patterns like this:

sed -e '/START/,/END/ command'    # apply command on lines between START and END pattern

or with line numbers like this:

sed -e '1,35 command'    # apply command on lines 1 to 35

or with a mixture, like this:

sed '1200,$ {/abc/ command}'     # apply command on lines 1200 to end of file that contain "abc"

Upvotes: 12

sat
sat

Reputation: 14949

If you specify two addresses, then you specify range of lines over which the command is executed. In your sed expression, it deletes all lines beginning with the line matched by the first pattern and up to and including the line matched by the second pattern.

Upvotes: 11

Related Questions