On Tue, 30 Dec 2003, Ciaran McCreesh wrote:

> 
> find . -name '*.html' -exec perl -pi.bak -e '$/="";' -e \
>   's- width="51"\s+height="20"--g' '{}' \;

I'm not picking on Ciaran alone, alot of folks need to read up on xargs.

You do NOT want to spawn an instance of perl for EACH file, using xargs 
will save a lot of processing time by spawning ONE perl instance (maybe 
a couple if there are a LOT of files)..

Here's a handy line I like to use, this handles those pesky files with 
spaces and other nasties in the filename:

find -type f -name '*.html' -print0 | xargs --null perl -pi -e 
's/find/replace/'

All assumes normal GNU versions, double check your local man pages! And 
don't forget to backup before doing any mass replace operation!
 

Bill Carlson
-- 
Systems Administrator    [EMAIL PROTECTED]      | Anything is possible,
Virtual Hospital      http://www.vh.org/      | given time and money.
University of Iowa Hospitals and Clinics      |       
Opinions are mine, not my employer's.         | 


--
[EMAIL PROTECTED] mailing list

Reply via email to