Looping through a log file
From: AJ Hartley (ajperl_at_mac.com)
Date: 03/04/05
- Next message: eric.hall_at_gmail.com: "Re: negative backreference?"
- Previous message: Tad McClellan: "Re: ranking texts against a white list"
- Next in thread: Arndt Jonasson: "Re: Looping through a log file"
- Reply: Arndt Jonasson: "Re: Looping through a log file"
- Reply: Tad McClellan: "Re: Looping through a log file"
- Reply: Mahesh M: "Re: Looping through a log file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Mar 2005 09:23:46 -0800
My project is to parse a text log file created by a propietary
publishing application and stuff the important information into a
database. The actual parsing of the information for a single event
using regular expressions was a slam dunk, though each line requires
it's own expression. But I'm needing some advice with a strategy for
looping through the file.
I'm running this process every mintute or so, no more than 10 events
can stack up in the file during that period.
Each "event" in the log file may contain four or five lines of
information. That's the parsing process mentioned above. Each event is
concluded with a dashed line. If the next line contains nothing, we can
exit. Otherwise the loop continues. Example:
Event 1 title
Event 1 user info
Event 1 time stamp info
Event 1 status info
Event 1 file path info
----------------------------------------
Event 2 title
Event 2 user info
Event 2 time stamp info
Event 2 status info
----------------------------------------
and so on...
My challenge is to figure out how run the parsing on each chunk and
then continue on to the next or exit as necessary based on the dashed
line.
Thanks for any advice you can offer...
- Next message: eric.hall_at_gmail.com: "Re: negative backreference?"
- Previous message: Tad McClellan: "Re: ranking texts against a white list"
- Next in thread: Arndt Jonasson: "Re: Looping through a log file"
- Reply: Arndt Jonasson: "Re: Looping through a log file"
- Reply: Tad McClellan: "Re: Looping through a log file"
- Reply: Mahesh M: "Re: Looping through a log file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|