Keep It Simple, Stupid | |
PerlMonks |
Re: I'm looking for a one-liner filter 'twixt two regexesby thpfft (Chaplain) |
on Sep 05, 2002 at 11:25 UTC ( [id://195335]=note: print w/replies, xml ) | Need Help?? |
perhaps I'm reading this too simply, and you mean something more complex by 'between two regexes', but it sounds like you just want: perl -pi.bak -e "s/start(.*?)stop/$1/s" *.htmlwhere 'start' and 'stop' are the opening and closing matches, and with a g modifier as well if you want to replace more than once in each file. update: hold on, that's stupid. sorry. you want to replace the whole file with the match, don't you, or capture that text somewhere else? d'uh. please ignore.
In Section
Seekers of Perl Wisdom
|
|