Find text between lines in linux
Posted
by
Kasper Mooijman
on Server Fault
See other posts from Server Fault
or by Kasper Mooijman
Published on 2012-11-06T23:47:29Z
Indexed on
2012/11/07
5:03 UTC
Read the original article
Hit count: 513
I have a log-file where at the end of a series of lines you can see if this block is relevant now I'm looking for a command like sed to delete de blocks ending with "Content-Length: 0" and beginning with the last "--" before this line.
I tried sed -n "/--/,/Content-Length: 0/d"
but this takes the first "--" and the first "Content-Length: 0" and deletes it.
ex :
line 1 "--"
line 2
line 3 "Content-Length: 20"
line 4 "--"
line 5
line 6 "Content-Length: 0"
i want to delete line 4,5 and 6 not line 1 to 6
hohw can i do this?
© Server Fault or respective owner