equal
deleted
inserted
replaced
3 |
3 |
4 use strict; |
4 use strict; |
5 use warnings; |
5 use warnings; |
6 use Date::Parse; |
6 use Date::Parse; |
7 use Memoize; |
7 use Memoize; |
8 use Smart::Comments; |
8 use if $ENV{DEBUG} => "Smart::Comments"; |
9 |
9 |
10 die "Usage: $0 pattern [file]…\n" if !@ARGV; |
10 die "Usage: $0 pattern [file]…\n" if !@ARGV; |
11 |
11 |
12 my $pattern = shift; |
12 my $pattern = shift; |
13 |
13 |
19 while (<>) { |
19 while (<>) { |
20 |
20 |
21 if ( |
21 if ( |
22 !/^(?<date>.{15}) |
22 !/^(?<date>.{15}) |
23 \s(?<host>\S+) |
23 \s(?<host>\S+) |
24 \s(?<service>\S+): |
24 \s(?<service>postfix\/\S+): |
25 \s(?<pfid>[[:xdigit:]]+): |
25 \s(?<pfid>[[:xdigit:]]+): |
26 \s(?<rest>.*)/x |
26 \s(?<rest>.*)/x |
27 ) |
27 ) |
28 { |
28 { |
29 print "$_\n" if /$pattern/i; |
29 print "$_\n" if / postfix\// && /$pattern/i; |
30 next; |
30 next; |
31 } |
31 } |
32 |
32 |
33 my $ts = str2time($+{date}); |
33 my $ts = str2time($+{date}); |
34 |
34 |