|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Date format of ll command
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 |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
Hi, Try a tiny shell script like: Code:
mm=`expr substr "$6" 1 2` dd=`expr substr "$7" 3 2` yyyy=`expr substr "$8" 5 2`" echo "$dd/$mm/$yyyy" Regards. Last edited by pludi; 12-07-2009 at 05:31 AM.. Reason: code tags, please... |
|
#3
|
|||
|
|||
|
Hi Ganesh, The below code does not give correct output. Code:
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 Code:
ll prp_ps.sql -rw-r--r-- 1 dashs sicalis 2572 Nov 25 2008 prp_ps.sql Any help??? Regards, Satya Last edited by pludi; 12-07-2009 at 05:32 AM.. Reason: code tags, please... |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing from Excel date format to MySQL date format | figaro | UNIX for Dummies Questions & Answers | 2 | 08-11-2009 03:23 PM |
| Which is the STRING format in the date command? | islegmar | Shell Programming and Scripting | 1 | 03-19-2009 08:33 AM |
| convert date format to mysql date format in log file | hazno | Shell Programming and Scripting | 3 | 03-03-2009 08:05 AM |
| date issue-find prevoius date in a patricular format | bsandeep_80 | UNIX for Advanced & Expert Users | 3 | 11-15-2007 07:42 PM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-27-2006 11:30 PM |