Hi,
Unix: HP-UNIX.
I have a requirement(part of my requirement) to get latest file modification date of all files(In a particular directory).
Using ll comand i m able to find out the modification date but not in the required format
My command and out put:
echo trp_pb.sql `ll trp_pb.sql|awk '{print $6 $7 $8}'`
Output:
trp_pb.sql Jan262007
I need the date in MM/DD/YYYY format.
Thanks in advance.
Regards,
Satya
Hi,
Try a tiny shell script like:
mm=`expr substr "$6" 1 2`
dd=`expr substr "$7" 3 2`
yyyy=`expr substr "$8" 5 2`"
echo "$dd/$mm/$yyyy"
Regards.
Hi Ganesh,
The below code does not give correct output.
mon=$(echo `ll prp_ps.sql|awk '{print $6}'`)
day=$(echo `ll prp_ps.sql|awk '{print $7}'`)
year=$(echo `ll prp_ps.sql|awk '{print $8}'`)
mm=`expr substr "$mon" 1 2`
dd=`expr substr "$day" 3 2`
yyyy=`expr substr "$year" 5 2`
echo "$dd/$mm/$yyyy"
And output is :
/No/
But actual date is
ll prp_ps.sql
-rw-r--r-- 1 dashs sicalis 2572 Nov 25 2008 prp_ps.sql
Any help???
Regards,
Satya