|
Delete all lines containing a string, plus 4 lines below it?
Hi everyone,
I've come across an unusual requirement for a service in my Ubuntu system.
Simply put, I need to find a way to search for all instances of a term in a file, delete lines containing containing that term, and delete four lines below each instance of that term.
Either that, or copy the entirety of a file to a new file and skip over all lines containing the term plus four below it.
This sounds kinda weird, I know. Without going too far into detail, I either have to change the logfile format for a server I'm running which is a huge pain in the butt, or I can just run a script to edit an HTML report generated from said logs. (Said report is really just for managers to peruse, and I like my log format, so I'm pursuing option 2.)
Thanks in advance!
Last edited by RedHelix; 01-26-2010 at 03:51 PM.
|