Date: Wed, 9 Nov 2005 13:52:57 -0500 From: Bart Silverstrim <bsilverstrim@athensasd.org> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: freebsd-questions@freebsd.org Subject: Re: log file conversion (OT?) Message-ID: <296d6450a57b88f22ad227ec4e629283@athensasd.org> In-Reply-To: <20051109184814.GA57162@flame.pc> References: <06fe145ebc265841b4c499f5dc1e72ab@athensasd.org> <20051109180353.GA10584@flame.pc> <c3593d564c07405fc09bd0e370319c1b@athensasd.org> <20051109184814.GA57162@flame.pc>
next in thread | previous in thread | raw e-mail | index | archive | help
On Nov 9, 2005, at 1:48 PM, Giorgos Keramidas wrote:
> On 2005-11-09 13:44, Bart Silverstrim <bsilverstrim@athensasd.org>
> wrote:
>> On Nov 9, 2005, at 1:03 PM, Giorgos Keramidas wrote:
>>> Yes. Perl should work fine here.
>>>
>>> $ echo '1131556815.537 101 172.16.2.153 TCP_HIT/200 35674 GET'
>>> | \
>>> perl -MPOSIX=strftime \
>>> -pe 'chomp; @x=split /\./; \
>>> $ts = strftime "%Y-%m-%d %H:%M:%S", (localtime($x[0])); \
>>> $_=$ts.".".join(".",@x[1,$#x])."\n";'
>>> 2005-11-09 09:20:15.537 101 172.153 TCP_HIT/200 35674 GET
>>
>> Is there a way to get it to take in each line of the logfile and
>> output
>> it to a new file? It wouldn't be as easy as a "cat access.log | (perl
>> code here) >> newfile.log" would it?
>
> Of course it would :)
>
> This is why I used the -pe option when I wrote the script above, to
> make
> sure that Perl acts as a 'filter'.
>
> - Giorgos
Thank you, I'll give it a try as soon as I can :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?296d6450a57b88f22ad227ec4e629283>
