how to extract date from ls -al [message #98416] |
Wed, 22 September 2004 08:25 |
Arun Peter
Messages: 1 Registered: September 2004
|
Junior Member |
|
|
I have file in unix like this one
ls -al
-rw-r--r-- 1 apeter dev 9 Sep 22 12:25 test
I want to extract the date portion (Sep 22) for some checking. I have used
ls -al test | cut -f6,7 -d' '
It doesn't seems to work.
How do I extract the date portion out. I am not very familiar with awk utility. Can someone help?
|
|
|
|
Re: how to extract date from ls -al [message #98423 is a reply to message #98417] |
Mon, 27 September 2004 18:47 |
Jai Vrat Singh
Messages: 205 Registered: September 2002 Location: Singapore
|
Senior Member |
|
|
Better to use, because different systems have different settigs, but starting from last 4 , each has the dates and filenames.
ls -lrt myfile | sed -f sed.file | awk -F'|' '{ printf("%s %s %sn",$(NF -3), $(NF -2), $(NF -1) ); }'
where sed.file
contains
The [[ ]] contains a space and a tab.
|
|
|