Hi Gurus,
I need to develop a script which picks the files in a pre-defined order.
The files from monday-friday will be named as abc_01_20130923 as monday's file and abc_02_20130924 as tuesday's..so..so forth till friday's which will be named as abc_05_20130927.It repeats over for the subsequent weeks in the same pattern
The requiremt is that if for instance on tuesday abc_02_20130924 file comes along with monday's abc_01_20130923, the monday's file sgould be copied first into a location and after an hour tuesday's file should be copied to that location.The file is the trigger to the script
I have the following logic in mind:
#!/sh/bin
>> Both the files come into the location
echo $filename >> output
sleep 5(Let both the filenames be written into the output file)
>> while read line
do
extract the 01, 02,03,04,05 part of the filenames as the case might be.
if two files come ; then
compare the number part of the two files
if [ 01<02 ] ; then ( basically a file bearing a smaller number should be sent first.It can 02 < 05/03 < 04.Depends on the day two files have come)
copy 01 file first to /location
wait for an hour
then
copy 02 file next to /location
else if only file comes
copy that file to /location
done < output
Please can anybody help me out here as i am still new to shell scripting. I use a bourne shell.Thanks