In pseudo code, you would do something like this:
- read the file line by line:
- parse timestamp for this line.
- If it is less than the start time, go to the next line.
- if it is longer than the end time, go to the next line!
- else: this is the line you want: print.
, -- .. , .
stdin :
while (my $line = <>)
{
}
split (. perldoc -f split). , .
( ), . perldoc perlre.
-, :
use strict;
use warnings;
use POSIX 'mktime';
my $starttime = mktime(33, 52, 12);
my $endtime = mktime(33, 59, 12);
while (my $line = <>)
{
my @fields = split(/\s+/, $line);
my $timestamp = $fields[2];
my ($hour, $min, $sec) = split(':', $timestamp);
my $time = mktime($sec, $min, $hour);
next unless ($time < $starttime) .. ($time > $endtime);
print $line;
}