--- cute <[EMAIL PROTECTED]> wrote:

> Now i create a temp file to store changed content.
> is there a simple way to change file content without
> creating temp
> files?
> 

Surely Perl can.
I always use one-line Perl to translate squid's
access.log.Lines on access.log are something like this
form:

1185173161.901      0 218.31.144.97 TCP_HIT/200 3919
GET
http://images.sample.com/e/vnet/images/ev_icon_2.jpg -
NONE/- image/jpeg

We can change the time format to what we can see:

$ perl -pi -e 's/^\d+\.\d+/localtime($&)/e' access.log


then the line become:

Mon Jul 23 14:46:01 2007      0 218.31.144.97
TCP_HIT/200 3919 GET
http://images.sample.com/e/vnet/images/ev_icon_2.jpg -
NONE/- image/jpeg


       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to