If I have 3 kinds of files in directory DATA1:
FileA.20060315.dat, FileB.20060315.dat, FileC.20060315.dat
FileC.20060316.dat
FileA.20060317.dat, FileB.20060317.dat
FileA.20060318.dat, FileB.20060318.dat, FileC.20060318.dat
If 3 files have the same date then run
$cat FileA.20060315.dat FileB.20060315.dat FileC.20060315.dat > FileD.20060315.dat and move these files to DATA2 .
if it doesnot have 3 files the same date then move it to DATA3 ???
How do you know what date to choose ?
#!/bin/ksh
cd ./DATA1
for file in *.dat; do
ls -1 $file|awk -F"-" '{
filedt = substr($2,1,8);
{
printf "%s\n",filedt
}
}' >> checkit;
done
cat checkit | sort -n |uniq > date.srt
20060315
20060316
20060317
20060318
I get file sort by date then how I check date by date ? do you know ?