Operating System - HP-UX
1842690 Members
2743 Online
110208 Solutions
New Discussion

Re: Is it possible to know only the date of a file ?

 
SOLVED
Go to solution
Deepu Chakravarty
Regular Advisor

Is it possible to know only the date of a file ?

When we do 'ls -l', full listing displays of a file. But if I need only date of a file (like filename and date of last update of that file) which command I should use ?
4 REPLIES 4
Naveej.K.A
Honored Contributor
Solution

Re: Is it possible to know only the date of a file ?

Hi,

ls -l |cut -c46-75 will give you date, time and filename

with best wishes
naveej
practice makes a man perfect!!!
Sanjiv Sharma_1
Honored Contributor

Re: Is it possible to know only the date of a file ?

# ls -l |cut -c46-75
It should help.
Everything is possible
V.Tamilvanan
Honored Contributor

Re: Is it possible to know only the date of a file ?

Hi,
This works fine for your requirement.

#ls -l|awk '{printf ("%s\t%s\t%s\t%s\n",$6,$7,$8,$9)}'
KapilRaj
Honored Contributor

Re: Is it possible to know only the date of a file ?

Hey....

ls -ltr |awk -F ":" '{if ( NF > 1 ) print $1,"KKKK",$2;else print $0}'|awk -v DATE=`date +%Y` '{ if ( NF > 9 ) print $6,$7,DATE,$11 ; else print $6,$7,$8,$9 }'

Regds,

Kaps
Nothing is impossible