Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Splitting a file using "common log format" help

by toolic (Bishop)
on Nov 10, 2012 at 21:08 UTC ( #1003278=note: print w/ replies, xml ) Need Help??


in reply to [SOLVED] Splitting a file using "common log format" help

You could separate out the datetime section using s/// before you split:

use warnings; use strict; while (<DATA>) { if (s/(\[.*])//) { my $dateTime = $1; my ($remoteIP,$rfc,$userID,$requestType,$statusCode,$sizeOfFil +e) = split; print "$statusCode $sizeOfFile\n"; } } __DATA__ 66.249.65.107 - - [08/Oct/2007:04:54:20 -0400] "GET /support.html HTTP +/1.1" 200 11179


Comment on Re: Splitting a file using "common log format" help
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-07-08 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls