[NTLUG:Discuss] Script question
Rick Matthews
Rick at Matthews.net
Sun Jan 6 00:28:25 CST 2002
MadHat wrote:
> try something like this using awk
>
> for x do
> n=`echo $x | awk -F . '{ $3++ }; { print $1"."$2"."$3 }'`
> echo "mv -f $x $n"
> done
Neat! For test purposes, I ran your script in a directory containing:
domains.0000.0
domains.1111.1
domains.2222.2
domains.3333.3
The echoed output was:
mv -f domains.0000.0 domains.0000.1
mv -f domains.1111.1 domains.1111.2
mv -f domains.2222.2 domains.2222.3
mv -f domains.3333.3 domains.3333.4
Great! Would you help me with one small detail? (I apologize that I
don't know how to modify your script to accomplish this!) We need to
make it run in inverse order i.e move 3 to 4, then move 2 to 3, then
move 1 to 2, then move 0 to 1. (Otherwise 1, 2, 3 & 4 will all be copies
of the same file.)
Thanks for your help!
Rick
More information about the Discuss
mailing list