more useful options | |
PerlMonks |
Re: how to check for a word in a file and if found remove previous and next -- 3 oneliner variationsby Discipulus (Canon) |
on Jan 26, 2016 at 11:50 UTC ( [id://1153667]=note: print w/replies, xml ) | Need Help?? |
Yes, i got fixed with this and i made unsuccesfull tries using eof..eof flip-flop to process even files.. anyway now i get two semi-obfuscated oneliners, the first, simpler, is called with a single arg (the name of file): while the latter is parametrizable one: firts arg is the regex used to match unwanted strings, the second is the number of lines to be removed after and before and then the filename:
I promise i'll try to no bother you anymore with this.. :=) update the parametrized oneliner can be shortend using -s switch (that has some problem anyhow) It is the second time i use -- too.
L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Seekers of Perl Wisdom
|
|