[Gllug] perl script
Nick Mailer
nickm at positive-internet.com
Wed Aug 21 23:28:29 UTC 2002
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 ;-)
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list