[Gllug] perl script

Thom May thom at positive-internet.com
Thu Aug 22 08:36:41 UTC 2002


* Mike Brodbelt (mike at coruscant.demon.co.uk) wrote :
> On Thu, 2002-08-22 at 00:28, Nick Mailer wrote:
> > On Wednesday 21 August 2002 7:42 pm, Thom May wrote:
> > 
> > > Ber. forking perl for this is uber-overkill
> > > #!/bin/bash
> > > for i in *jpeg
> > > do
> > >         new=$(echo $i|sed -e \
> > >         's#^\(.\)\(.\)\(.\)\(.\)\(.\)\(.*\)#\4\5\3\1\2\6#');
> > >         mv $i $new;
> > > done
> > >
> > > Sorry about the nasty sed regexp - it's doable with bash direct but that is
> > > dark magic.
> > > -Thom
> > 
> > So instead of forking one process of perl, you multiply-fork echo, sed and mv. 
> > Well done, Mr Efficiency ;-)
> 
> <pedant>
> Echo is a shell builtin in bash.
> </pedant>
> 
And lets compare sizes of sed and perl, shall we?
On second thoughts, I can't be bothered - we all know where this is going
:-)
-Thom

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list