![]() |
|
There's more than one way to do things | |
PerlMonks |
Re: How do I read a log file that contents recurring log messages those are separated by newline characters?by pileofrogs (Priest) |
on Oct 14, 2010 at 19:16 UTC ( #865336=note: print w/replies, xml ) | Need Help?? |
This is what perl is great for. Probably the most direct approach would be to parse each line with a regex to get the parts you care about (IE not the timestamp). Create a hash where the key is the relevant part of the line and the value is a number that you increment every time you find the same message. Notice you're not keeping the whole file in memory, just one instance of each line and a number. --Pileofrogs
In Section
Seekers of Perl Wisdom
|
|