Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Parsing log files

by mifflin (Curate)
on Jun 28, 2005 at 03:01 UTC ( [id://470456]=note: print w/replies, xml ) Need Help??


in reply to Parsing log files

Here's my solution...
use warnings; use strict; my $date; my $lastdate = ''; my $line = 0; while(<DATA>){ $line++; $date = $_; if (($lastdate ne $date) && ($lastdate ne '')){ print "$line: $lastdate"; } $lastdate = $date; } print "$line: $lastdate"; <>; __DATA__ 10 10 10 11 11 11 12 12 12
produces...
4: 10 7: 11 9: 12

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-03-28 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found