Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Full Created/Modified Date & Time of a file

Status
Not open for further replies.

navneetkaur

Technical User
Sep 12, 2002
1
IN
Hi All

I have a requirement for extrracting full date and time of a particular file.

I used the following command
ls --full-time -l -Str test.txt| tr -s " "|cut -f6,7,8,9 -d" "

This command works fine on Unix env but fails on Solaris.
The reason why it fails is because the option "--full-time " is not available on solaris.

Please let me know the solution to this query

Thanks and Regards
Navneet

 
I haven't found a way to do that in Solaris (and would be keen to hear if anyone has), but as an alternative you could use is a quickie perl script such as.

[tt]perl -e 'print localtime((stat("filename"))[9]) . "\n";'[/tt] Annihilannic.
 
/bin/ls -l|awk '{print $6, $7, $8, $9;}'
will also work if you don't need
access-time, modified-time, status-change
see man stat -----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top