Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Help parsing badly constructed logfiles

by Bethany (Scribe)
on Jul 13, 2014 at 17:22 UTC ( [id://1093450]=note: print w/replies, xml ) Need Help??


in reply to Help parsing badly constructed logfiles

(N.B.: This is a blue-sky suggestion. Depending on the logfiles' sizes and maybe available resources it might be impractical, don't know. The approach has worked well for me for a certain class of text file messed-up-ness.)

Independent of newlines, is there a reliable way to tell where "real" lines, meaning actual log entries, end?

For instance, if whole log entries have fixed length you could remove all newlines, then break the combined text into fixed-length records. If it were that easy you'd probably have tried this, but maybe the approach can be altered to suit your situation -- if entries always end with some characteristic pattern that doesn't occur elsewhere in an entry, you could split just after each match of that pattern, and so forth. Maybe a combination of checking for a pattern within a certain range of possible lengths will do the trick.

  • Comment on Re: Help parsing badly constructed logfiles

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found