- if ($line =~ m{\Q$string}io) {
- my @line = split '\^', $line;
- my $t = shift @line;
- print atime($t), ' ', join('^', @line), "\n";
+ push @prev, $line;
+ shift @prev while @prev > $nolines;
+ if ($line =~ m{$string}io) {
+ for (@prev) {
+ s/([\x00-\x1f\x7f-\xff])/sprintf("\\x%02X", ord($1))/eg;
+ my ($t, $l) = split /\^/, $_, 2;
+ print atime($t), ' ', $l, "\n";
+ }
+ @prev = ();