![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| change timestamp of file | isingh786 | HP-UX | 1 | 05-15-2006 10:56 AM |
| Create file with old timestamp | Kris_Kart_101 | UNIX for Dummies Questions & Answers | 2 | 10-14-2005 10:18 AM |
| changing timestamp of a file | krishan | SUN Solaris | 1 | 05-23-2005 07:50 AM |
| timestamp of file | krisdhar | UNIX for Dummies Questions & Answers | 4 | 10-28-2003 07:31 AM |
| putting a timestamp in a file | rocker40 | UNIX for Dummies Questions & Answers | 2 | 10-22-2003 08:56 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Could someone please tell me how to find the last modified date (date,hours,minutes,seconds) of a file in the format YYYY-MM-DD hh:mm:ss of a file using only standard HP-UX commands? I looked for options in "ls" command but I couldn't find any options for HP-UX which gets the date details upto the seconds. Any help will be greatly appreciated. Cheers Steve |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Ok let's say that the name of the file is "junk". On HP-UX you can do:
perl -e '@d=localtime ((stat(shift))[9]); printf "%4d-%02d-%02d %02d:%02d:%02d\n", $d[5]+1900,$d[4]+1,$d[3],$d[2],$d[1],$d[0]' junk And yes, perl comes with HP-UX. It is in /usr/contrib. But you may have a more recent version in /usr/local or /opt. |
|
#3
|
|||
|
|||
|
Thank you Perderabo!
It works great but is it possible to do it with either "sed" or "awk" ? Cheers Steve |
|
#4
|
||||
|
||||
|
No. All they can do is manipulate the output of ls which simply does not present enough information.
|
|
#5
|
|||
|
|||
|
Ok,
Thanks alot Perderabo! Cheers Steve |
|||
| Google The UNIX and Linux Forums |