Hi All,
I have two files (given below) each exists under different paths. I want to compare the modification time stamp of file1.txt is lessthan the modification time of file2.txt.
month1=`ls -l file1.txt | awk '{ print $6}'`
date1=`ls -file1.txt | awk '{ print $7}'`
time1=`ls -lfile1.txt | awk '{ print $8}' | cut -f 1 -d ":"`
month2=`ls -l file2.txt | awk '{ print $6}'`
date2=`ls -l file2.txt | awk '{ print $7}'`
time2=`ls -l file2.txt | awk '{ print $8}' | cut -f 1 -d ":"`
i thought of perform the comparision by checking the month1 is lesser than month2, but what i have here is String (in which i dont know anyway to perform lessthan operations). I can use a case statement and assign the 1,2 ... 12, like case $month1; Jan) month1final=1 and case $month2; Jan) month2final=1 .. etc. then now i can do lessthan operation.
Is there any simple solution to compare the modification time of two files. Please provide your thoughts. Let me know if i am not clear.