Search squid archive

Re: [squid-users] timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 19 Mar 2005, Ronny wrote:

Well if I want to know who was where at what time I use perl to convert timestamps from epoch to 'human' or unix time ;-)

cat /access.log path | perl -l -a -n -e '$F[0] = scalar localtime $F[0]; print "@F"'

Here is a shorter version, and which also preserves the millisecond field and alignment:


perl -pe 's/(\d+)/localtime($1)/e' access.log

  -p    loop over the input file(s)

  -e    execute following statement

  s/    substitute

  (\d+) pattern matching sequence of digits

  localtime($1)
        substitution. $1 refers to first () in the pattern

  /e    substitution is an expression

Regards
Henrik

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux