Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the comma in sed commands stand for?

Tags:

sed

What does the following command mean:

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

What does , stand for?

like image 212
Roopak Vasa Avatar asked Apr 09 '14 10:04

Roopak Vasa


2 Answers

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.

like image 147
sat Avatar answered Oct 06 '22 10:10

sat


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"
like image 43
Mark Setchell Avatar answered Oct 06 '22 11:10

Mark Setchell