Re: Need help with 3 line search and delete

"[email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
If the DROP lines are always followed by two lines to be dropped (a possibility considering that it's a log file), here is a simple way that I think works:
 

 $ cat logfile.log
line #1 to keep
line #2 to keep
DROP
line to drop
ERROR
line #3 to keep

 

 $ sed "/^DROP/ {N; N; d}" logfile.log
line #1 to keep
line #2 to keep
line #3 to keep

 

 Daniel



[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.