in reply to Re: Log parsing by timestamp dilema
in thread Log parsing by timestamp dilema

tall_man,
THANKS!
I have no idea what it will take to hack File::MergeSort to give me file name/path, but it is certainly worth a shot. I had already begun writing code to perform the logic I came up with as an interpretation of adrianh's solution when DaveH provided a fully integrated solution with some extra bells and whistles.

For completeness (and because I think your solution will give the fastest bang for my buck), I will bench all 3 solutions and maybe post the results.

Cheers - L~R

  • Comment on Re: Re: Log parsing by timestamp dilema

Replies are listed 'Best First'.
Re^3: Log parsing by timestamp dilema
by tall_man (Parson) on Feb 01, 2003 at 22:52 UTC
    I have taken a quick look through the File::MergeSort code. Here are my suggestions about how to get the file names. In the constructor, there is a loop that opens the files and saves the file handles. I would add a line to save the file names too:
    $self->{files}->[$n]->{fh} = $fh; $self->{files}->[$n]->{name} = $file;
    In next_line, capture the value of $self->{sorted}->[0]->{name} when you read from the handle, and do an array return with both the line and the filename. That should do it.