Using sed to delete range of lines except the end pattern -


input.txt:

blah1 blah2 start_pattern blah3 blah4 blah5 end_pattern blah6 blah7 

i input.txt become:

blah1 blah2 end_pattern blah6 blah7 

i tried following, didn't work.

sed -i "/start_pattern/, /end_pattern/{$!d}" input.txt 

this question deals problem:

$ sed '/start_pattern/,/end_pattern/{/end_pattern/!d}' foo.txt blah1 blah2 end_pattern blah6 blah7 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -