RE: Year of Unix file
Well, Of Course... :) - Kirti Deshpande Verizon Information Services http://www.superpages.com -Original Message- From: yong huang [SMTP:[EMAIL PROTECTED]] Sent: Sunday, July 29, 2001 3:46 PM To: Multiple recipients of list ORACLE-L Subject: RE: Year of Unix file 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 dba410 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 dba720 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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Deshpande, Kirti 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).
RE: Year of Unix file
Title: RE: Year of Unix file save the following as fstat.c, compile it with cc -o fstat fstat.c, then run it as fstat myfile #include stdio.h #include sys/types.h #include sys/stat.h #include errno.h #include time.h int rtn; struct stat buf_st; struct tm *tm_st; main( argc, argv, envp) int argc; char **argv, **envp; { time_t now; if( argc != 2 ) { fprintf( stderr, Error: number of args\n ); exit( 1 ); } rtn = stat( argv[1], buf_st ); if( rtn != 0 ) { fprintf( stderr, stat() return code=%d\n, rtn ); perror( error text= ); exit(1); } fprintf( stderr, FILE=%s\n, argv[1] ); fprintf( stderr, SIZE=%d\n, buf_st.st_size ); fprintf( stderr, MODE=%d\n, buf_st.st_mode ); tm_st = localtime( buf_st.st_mtime ); fprintf( stderr, MTIME=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s, buf_st.st_mtime, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( buf_st.st_mtime ) ); tm_st = localtime( buf_st.st_atime ); fprintf( stderr, ATIME=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s, buf_st.st_atime, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( buf_st.st_atime ) ); tm_st = localtime( buf_st.st_ctime ); fprintf( stderr, CTIME=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s, buf_st.st_ctime, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( buf_st.st_ctime ) ); time( now ); tm_st = localtime( now ); fprintf( stderr, NOW =%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s, now, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( now ) ); now = 0; tm_st = localtime( now ); fprintf( stderr, EPOCH=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s, now, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( now ) ); } -Original Message- From: prasad maganti [mailto:[EMAIL PROTECTED]] Sent: Friday, July 27, 2001 4:11 AM To: Multiple recipients of list ORACLE-L Subject: Year of Unix file Hi dba's when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. any commands prasad. __ 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: prasad maganti 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).
OT RE: Year of Unix file
Title: RE: Year of Unix file Maybe it's just me, and it could be because I am not following this thread at all, but. Is this the list's longest running thread to date? lol. no offense meant! - Ross -Original Message-From: Brian MacLean [mailto:[EMAIL PROTECTED]]Sent: Monday, July 30, 2001 5:21 PMTo: Multiple recipients of list ORACLE-LSubject: RE: Year of Unix file save the following as fstat.c, compile it with "cc -o fstat fstat.c", then run it as "fstat myfile" #include stdio.h #include sys/types.h #include sys/stat.h #include errno.h #include time.h int rtn; struct stat buf_st; struct tm *tm_st; main( argc, argv, envp) int argc; char **argv, **envp; { time_t now; if( argc != 2 ) { fprintf( stderr, "Error: number of args\n" ); exit( 1 ); } rtn = stat( argv[1], buf_st ); if( rtn != 0 ) { fprintf( stderr, "stat() return code=%d\n", rtn ); perror( "error text=" ); exit(1); } fprintf( stderr, "FILE=%s\n", argv[1] ); fprintf( stderr, "SIZE=%d\n", buf_st.st_size ); fprintf( stderr, "MODE=%d\n", buf_st.st_mode ); tm_st = localtime( buf_st.st_mtime ); fprintf( stderr, "MTIME=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s", buf_st.st_mtime, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( buf_st.st_mtime ) ); tm_st = localtime( buf_st.st_atime ); fprintf( stderr, "ATIME=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s", buf_st.st_atime, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( buf_st.st_atime ) ); tm_st = localtime( buf_st.st_ctime ); fprintf( stderr, "CTIME=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s", buf_st.st_ctime, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( buf_st.st_ctime ) ); time( now ); tm_st = localtime( now ); fprintf( stderr, "NOW =%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s", now, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year - 100, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( now ) ); now = 0; tm_st = localtime( now ); fprintf( stderr, "EPOCH=%10.10d - %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d -%s", now, tm_st-tm_mon + 1, tm_st-tm_mday, tm_st-tm_year, tm_st-tm_hour, tm_st-tm_min, tm_st-tm_sec, ctime( now ) ); } -Original Message- From: prasad maganti [mailto:[EMAIL PROTECTED]] Sent: Friday, July 27, 2001 4:11 AM To: Multiple recipients of list ORACLE-L Subject: Year of Unix file Hi dba's when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. any commands prasad. __ 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: prasad maganti 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).
RE: OT RE: Year of Unix file
I don't think so... AFAICR, Job in Saudi Arabia is still the Champ ;) - Kirti -Original Message- From: Mohan, Ross [SMTP:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 4:36 PM To: Multiple recipients of list ORACLE-L Subject: OT RE: Year of Unix file Maybe it's just me, and it could be because I am not following this thread at all, but. Is this the list's longest running thread to date? lol. no offense meant! - Ross -Original Message- From: Brian MacLean [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 5:21 PM To: Multiple recipients of list ORACLE-L Subject: RE: Year of Unix file save the following as fstat.c, compile it with cc -o fstat fstat.c, then run it as fstat myfile #include stdio.h #include sys/types.h #include sys/stat.h #include errno.h #include time.h -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Deshpande, Kirti 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).
RE: Year of Unix file
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 dba410 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 dba720 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).
Year of Unix file
Hi dba's when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. any commands prasad. __ 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: prasad maganti 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).
Re: Year of Unix file
when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. The 8th field of ls -lt indicates the hour if the file was created in the current year, otherwise it indicates the year. ciao carlo -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Carlo Vaccari 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).
RE: Year of Unix file
Correct, as far as the 8th field reporting the year. 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 dba410 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 dba720 Jan 7 2001 bdf.out HTH... Regards, - Kirti Deshpande Verizon Information Services http://www.superpages.com -Original Message- From: Carlo Vaccari [SMTP:[EMAIL PROTECTED]] Sent: Friday, July 27, 2001 7:40 AM To: Multiple recipients of list ORACLE-L Subject: Re: Year of Unix file when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. The 8th field of ls -lt indicates the hour if the file was created in the current year, otherwise it indicates the year. ciao carlo -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Deshpande, Kirti 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).
RE: Year of Unix file
If you look in the man pages on thels command it says something about the LC_TIME environment variable being used to control the date string. You might investigate that . -Original Message- Sent: Friday, July 27, 2001 7:40 AM To: Multiple recipients of list ORACLE-L when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. The 8th field of ls -lt indicates the hour if the file was created in the current year, otherwise it indicates the year. ciao carlo -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Carlo Vaccari 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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Kevin Lange 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).
Re: Year of Unix file
Is this anything like the year of the cat? Jared prasad maganti prasadm_g@yah To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] oo.com cc: Sent by: Subject: Year of Unix file [EMAIL PROTECTED] om 07/27/01 04:10 AM Please respond to ORACLE-L Hi dba's when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created. is there any way to see the year that is created. any commands prasad. __ 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: prasad maganti 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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: 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).