|Just another Perl shrine|
Re: how to check for a word in a file and if found remove previous and next -- 3 oneliner variationsby Discipulus (Abbot)
|on Jan 26, 2016 at 11:50 UTC||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.
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.