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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -