I have the script which appends month and year to the name of the
file. Now every time when I append the month-year combination I
have to subtract 2 months from the current date and then append
it, since we are sending our vendor 2 months prior worth of data
eveytime.
#! /usr/bin/ksh
filefullname=$1
filename=${filefullname%.}
fileext=${filefullname## .}
DATE=`date +%m%y`
newfilename="${filename}${DATE}.${fileext}"
mv $filefullname $newfilename
I am not sure how to go about it, Any help or sample script would help me get going...
Thanks..
reborg
July 21, 2006, 6:33pm
2
Go to the "Answers to frequently asked questions" section. You'll find a whole section on this or similar questions
I did happen to look into FAQ section before I posted it here..the solution is with GNU and I am looking for a pure Unix script solution...
Also our OS here does not support
date -v
solution..
Thanks
reborg
July 21, 2006, 6:42pm
4
You'll need to read a few more, there are solutions using pure script, and perl in addition to the gnu method.
ie., see Perderabo's datecalc script
datecalc is mentioned in the third sentence and it is the first solution proposed in the faq article.