[Chester LUG] Help with a bash script

David Holden dh at iucr.org
Fri May 16 11:03:18 UTC 2008


On Thursday 15 May 2008, Stuart Burns wrote:
> Hi Everyone.
>
> I need a little help with a batch file. I have managed a bit of it, but i'm
> a bit lost now.
>
> What I need to do is
>
>
>    1. Looks for file RS000001.001 in folder
>    2. Rename it RSmmdnnn.001 (mm=month, d= day number {Monday=1},
>    nnnn=unique count for the day)
>
> Now this file can appear up to several times a day (ie its going to run as
> a cron job every half hour to pick up the files as they are dumped by ftp)
> I can do the basic stuff with the date ie DATE = `date +%m%u` but setting
> up the nnnn bit is where  I am getting lost.
>
> Any help appreciated.
>
> Stu

if it needs to chronologically ordered why not just use the hour

 x=`date +%H`
 printf "%03d" $x

or 

 x=`date +%H`
y=`print "%03d" $x`

echo $y



Dave.




Dave.




-- 
Dr. David Holden.

See: <http://www.gnu.org/philosophy/no-word-attachments.html>
regarding Word or PowerPoint. GPG key available on request.
-------------------------------------------------------------




More information about the Chester mailing list