先にこちらを見たほうが良いかも。(2004-04-04) 「時刻 squid」でググって perl -pe 's/\d+\.\d+/localtime $&/e' が正解。参考 squid log 時刻変換 とか squid 設定方法 squidのログの時刻squid のログは 882008749.530 522 127.0.0.1 TCP_MISS/200 1556 GET http://localhost/ - DIRECT/localhost text/html のように先頭がunix時間に記録されているのをローカルタイムに変換するフィルターのperlスクリプト。 onelinerに出来そうだけど深い追いはしない。 #! /usr/bin/perl while( <>){ chop; ($time, $rest) = /([0-9.]+)[ ]+(.*)/; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time); $mon++; $year += 1900; print "$year-$mon-$mday $hour:$min:$sec $rest\n"; } 先の例はこのように変換される。 1997-12-13 19:25:49 522 127.0.0.1 TCP_MISS/200 1556 GET http://localhost/ - DIRECT/localhost text/html |