http://qs321.pair.com?node_id=206977


in reply to Daily Log Audit (regex issue)

I would consider a brute force method to begin with and then refactor from there. Here's where I'd start:

First, you need to decide how to start the processing:

I'd parse the log file line by line and use a hash to keep the necessary info for the jobs in progress:

$jobs{$partition}{jobname} $jobs{$partition}{starttime} $jobs{$partition}{endtime} $jobs{$partition}{rc}

You examine each line and determine:

Determine your strategy for what happens when you reach EOF:

The regexen used to parse each line should be fairly straight forward, you only have to read the file once, and you keep storage to a minimum. Would this be the most efficient way to do it? I don't know but as I said, during the coding process, you may gain some insight to try something different.

--Jim