[NTLUG:Discuss] Script question

MadHat madhat at unspecific.com
Mon Jan 7 08:09:42 CST 2002


At 12:28 AM 1/6/2002 -0600, Rick Matthews wrote:
>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.)

It's all about how you send the files in.  Since ls is producing the list, 
look at the command like options for ls (like -r for reverse or maybe the 
use of -t for time based sorting).  This is the part where it is very 
specific to how your files are set up.

>Thanks for your help!
>
>Rick
>
>
>_______________________________________________
>http://www.ntlug.org/mailman/listinfo/discuss

--
MadHat at unspecific.com





More information about the Discuss mailing list