in reply to How can I make a index for log?
It's not exactly clear what it is that you want to achieve. However, creating an index at run time from the log file is fairly straight forward. Something based on the following sketch code ought to get you started:
open my $inFile, '<', $logFileName or die "Failed to open $logFileName +: $!"; my %index; my $lastPos = 0; while (<$inFile>) { next unless /^(\d{14})$/; $index{$1} = [$., $lastPos]; } continue { $lastPos = tell ($inFile); }
which builds an index keyed by time stamp with values giving the line number and index into the file of the start of the line.
|
|---|