Comparing system time and log file time 
Author Message
 Comparing system time and log file time

Hi all,

Anybody know use awk language to write a script to compare log file time
and system time in HP-UX or Solaris. In Linux, awk has systime function.

But, HP-UX , Solaris don't have systime().

Ken



Sun, 13 Oct 2002 03:00:00 GMT  
 Comparing system time and log file time

Quote:

> Anybody know use awk language to write a script to compare log file time
> and system time in HP-UX or Solaris. In Linux, awk has systime function.

Linux has GNU Awk (gawk). If you can't (are not allowed to) install gawk
on your HP/UX and Solaris machines, maybe you can read the output of the
"date" command - if you find a suitable format string for your "date".

Then you can do something like this in awk:

  Cmd = "date '+%Y-%m-%d %H:%M:%S'"
  Cmd | getline Date
  close(Cmd)

... and have the current date and time in "Date".

If your "date" command(s) don't offer the format that you need,
use GNU "date" ;-) or (have somebody) write a tiny C program that uses
the strftime() function.

At least on Solaris, use "nawk" instead of "awk". "awk" on Solaris is an
ancient version of Awk.

Regards...
                Michael



Sun, 13 Oct 2002 03:00:00 GMT  
 Comparing system time and log file time

Quote:

>Hi all,

>Anybody know use awk language to write a script to compare log file time
>and system time in HP-UX or Solaris. In Linux, awk has systime function.

>But, HP-UX , Solaris don't have systime().

Ken --

Exactly what kind of time comparison ?

What resolution ( D,H,M,S,mS ) ?

I assume you mean something like "When was log.file last touched ?"

I imagine something can be done using a mix of sh & nawk ...

More info please !

-- kjh
--
------------------------------------------------------------

1111 Seacoast Dr.  Unit 41   |  home:   (619) 423-4451     |
Imperial Beach, CA   91932   |                             |



Wed, 16 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. time zones, daylight saving time, and universal time

2. time and scheduling (was: bug report: [ #447945 ] time.time() is not non-decreasing)

3. Bug in time.c (was Time.times problems)

4. Create Time / date or Modified Time / date of a txt file

5. file time to dos time

6. system date and time of retrieved data from file in waveform graph

7. real time sharing of files by Ada and C on DEC system

8. How to write the system time in files?

9. Multi-Time dependent Logging/Viewing from the same source

10. Automatically logging Running Time of a VI

11. question on comparing date/time in AWK

12. Comparing time in microfocus Cobol

 

 
Powered by phpBB® Forum Software