How about using stat(2)?

$ ls -l proc.txt
-rw-rw-r--   1 oracle   dba         3414 Jul  1 00:10 proc.txt
$ perl -e '$a=(stat "proc.txt")[9]; print int $a/31536000+1970,"\n"'
2001

There's a better way to convert seconds since epoch to year but for now I just
divide it by number of seconds in a year and add 1970 to it.

The above perl one-liner is just a convenient way to call stat(2).

Yong Huang
[EMAIL PROTECTED]

you wrote:

But the year replaces the time in the 8th field only when the last
modification time for the file is more than 6 month (even if it is in the
current year :)

For example, take a look at line 1,2 (less than 6 month old as of today) &
3,4,5 (over 6 months old as of today)..

-rw-rw-r--   1 oracle     dba           2880 Feb  5 08:05 junk.lst
-rwxrwx---   1 oracle     dba            410 Jan 30 11:08 show_all.ksh
-rwx------   1 oracle     dba             77 Jan 25  2001 t1
-rw-rw-r--   1 oracle     dba           3971 Jan 10  2001 my.lst
-rw-rw-r--   1 oracle     dba            720 Jan  7  2001 bdf.out


HTH...

Regards,

- Kirti Deshpande
  Verizon Information Services
   http://www.superpages.com

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: yong huang
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to