5 use feature qw
/switch/;
6 use POSIX qw
/strftime/;
21 Getopt
::Long
::Configure
(qw
/no_ignore_case/);
23 'f|from=s' => \
$dt_from,
24 't|to|till=s' => \
$dt_till,
25 'r|match-date=s' => \
$re_match_date,
26 'u|print-unparsed!' => \
$print_unparsed,
27 'p|prefix-filename!' => \
$prefix_filename,
29 die "Usage: $0 -f FROM -t TO [-r | -u] [FILES]";
31 $ts_from = defined $dt_from ? str2time
($dt_from) : undef;
32 $ts_till = defined $dt_till ? str2time
($dt_till) : undef;
33 $re_match_date = '>(\S+\s+\S+\s+\S+)';
35 printf STDERR
"Searching from: %s\n", $ts_from ? strftime
('%c', localtime $ts_from) : "ANY";
36 printf STDERR
"Searching till: %s\n", $ts_till ? strftime
('%c', localtime $ts_till) : "ANY";
40 my ($ext) = ($fname =~ /\.([^\.]+)$/);
49 $decompressor = "unxz";
53 $decompressor = "gunzip";
60 if(defined $decompressor)
62 @source = $decompressor, $fname;
68 if(open my $fh, $openmode, @source)
72 my ($dt) = (m/$re_match_date/);
75 my $ts = str2time
($dt);
76 if((not defined $ts_from or $ts >= $ts_from) and (not defined $ts_till or $ts <= $ts_till))
81 elsif($print_unparsed)