Hi al,
Im trying to write something to read a date file and append each date to my file output name.
Datefile:
20091001
20091015
Final output file I would like is:
DATA_20091001_20091015.xls
The script Im trying, but not working, is
n=`wc -l < dates_yymmdd.txt`
i=1
while [ "$i" -le "$n" ]
do
line=`cat dates_yymmdd.txt | head -$i | tail -1`
echo $line
datevariable$i=$line
i=`expr $i + 1`
done
cp DATA.xls DATA_`echo $datevariable1`_`echo $datevariable2`.xls
Scott
October 21, 2009, 11:20am
2
while read DATE1; do
read DATE2
cp DATA.xls DATA_${DATE1}_$DATE2.xls
done < dates_yymmdd.txt
This is a bit over-complicated if you only have two dates in you input file. It's not clear from your question how many dates you have or how many files you want to copy.
while read DATE1; do
read DATE2
cp DATA.xls DATA_${DATE1}_$DATE2.xls
done < dates_yymmdd.txt
This is a bit over-complicated if you only have two dates in you input file. It's not clear from your question how many dates you have or how many files you want to copy.
Thank you sir, that worked. I'm always making things over complicated