Re: Need help with 3 line search and delete
| 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]