[Gllug] perl script

Mike Brodbelt mike at coruscant.demon.co.uk
Thu Aug 22 01:23:33 UTC 2002


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>

Mike.


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




More information about the GLLUG mailing list