I cheated and used Tcl from the command line. Here's a short Tcl script
that will run on stdin:

#!/usr/bin/tclsh
while {! [eof stdin]} {
    gets stdin oneline
    if {[regexp {^([0-9]+)} $oneline match seconds]} {
        puts "[clock format $seconds] $oneline"
    } else {
        puts "$oneline"
    }
}

You can do basically the same thing in Perl or C. Doesn't really matter.

HTH,
Brian

Ronneil Camara writes:

> How where u able to get "Sun Apr 09 04:05:25 PHT 2000". I want do it in perl
> but I'm no good in perl.
> 
> > -----Original Message-----
> > From: brianb [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, April 17, 2000 5:20 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [plug] squid access logs
> > 
> > 
> > 
> > If the timestamp is in seconds since the Epoch, you can use 
> > the ctime(3)
> > family of functions in C. In Perl I think you can use gmtime 
> > or localtime,
> > and in Tcl you use clock format. Whichever you use, for 955224325 you
> > should probably get Sun Apr 09 04:05:25 PHT 2000
> > 
> > HTH,
> > Brian
> > 
> > Ronneil Camara writes:
> > 
> > > I need help. Can someone help me on how I can compute the 
> > timestamp saved in
> > > /var/log/squid/access.log and provide an output which is 
> > human readable (ex.
> > > date or time). We really need it coz someone anonymously 
> > emailed us. The
> > > request from the webbased email could come from internally.
> > > 
> > > Please see example below:
> > > 
> > > 955224325.864   3403 192.168.2.52 TCP_MISS/200 3557 GET
> > > http://lc4.law5.hotmail.passport.com/cgi-bin/logout? -
> > > DIRECT/lc4.law5.hotmail.passport.com text/html
> > > 
> > > Btw, I don't need sqmgrlog answer. Thank you. :-)
> > 
> > 
> > --
> > Brian Baquiran <[EMAIL PROTECTED]>
> > http://www.baquiran.com/
> > AIM: bbaquiran
> > 
> > -
> > Philippine Linux Users Group. Web site and archives at 
> http://plug.linux.org.ph
> To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]
> 
> -
> Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
> To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]


--
Brian Baquiran <[EMAIL PROTECTED]>
http://www.baquiran.com/
AIM: bbaquiran

-
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Reply via email to