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
Post a Comment