[Gllug] Poor scripting?!

Richard Huxton dev at archonet.com
Tue Mar 11 16:01:54 UTC 2008


John Edwards wrote:
> On Tue, Mar 11, 2008 at 02:41:16PM +0000, Henrik Morsing wrote:
>> Hi, I've had a look and help from the #gllug folks (thanks!), does
>> this look like it would do the same job, called as 'rename
>> s/cerprod/$CRMDB/ s/medprod/$CRMDB /cerillion'?
> <snip> 
> 
> Is there any reason you aren't using Perl's own rename program?
> 
> find . -iname "*pattern*" -print0 | xargs -r0 rename 's/pattern/replacement/g'

Nice.

> Of course you may have too many directories for rename to process as
> arguments. It certain works with several thousand.

Ah, xargs --max-args should handle that though.

Hmm - not sure about the /g on the pattern, although I see that was 
present in the original question. I'd worry about accidentally matching 
directory namse.

-- 
   Richard Huxton
   Archonet Ltd
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list