On Tue, 2003-12-30 at 12:04, Ciaran McCreesh wrote: > On Tue, 30 Dec 2003 10:14:26 -0600 Andrew Gaffney > <[EMAIL PROTECTED]> wrote: > | Although, there is one case this doesn't work for. In some of the HTML > | files, the text I'm looking to strip is split over 2 lines like: > | > | <a href="someurl"><img src="button.gif" border="0" width="51" > | height="20"></a> > | > | How would I strip the text in this case? > > find . -name '*.html' -exec perl -pi.bak -e '$/="";' -e \ > 's- width="51"\s+height="20"--g' '{}' \;
I would make two changes to this: 1) change $/=""; -> undef $/; 2) add s to the end of the regex (this tells perl run the regex accross the entire string crossing new line boundaries. So the result would be: find . -name '*.html' -exec perl -pi.bak -e 'undef $/;' -e \ 's- width="51"\s+height="20"--gs' '{}' \; Lincoln -- Lincoln A. Baxter <[EMAIL PROTECTED]> -- [EMAIL PROTECTED] mailing list