#use strict;
########################################################
## Copyright (c) 2008 Kirk Bauer
## Covered under the included MIT/X-Consortium License:
## http://www.opensource.org/licenses/mit-license.php
#<< lines removed >>
#########################################################
use POSIX qw(strftime);
use Logwatch ':dates';
my ($SearchDate, $ThisLine);
my ($incount, $outcount) = (0, 0);
my $time = time;
my $hostname = $ENV{'HOSTNAME'};
my $OSname = $ENV{'OSname'};
$SearchDate = TimeFilter("%y%m%d:%H%M%S");
my $all = 0;
while (defined($ThisLine = <STDIN>)) {
$incount++;
if ($SearchDate =~ m/\.+/) {
$SD = $SearchDate;
$SD =~ s/\(//g;
@SDPARTS = split (':',$SD);
$datepart1 = $SDPARTS[0];
if ($all == 1) {
print $ThisLine;
$outcount++; }
# if date is the same, print line if time is greater or equal to
# search time
elsif ($ThisLine =~ m/^\d+($datepart1):(\d{0,6})/) {
$linedate = $1.':'.$2;
if ($linedate ge $SD) {
print $ThisLine;
$outcount++; }
}
# else, if date is larger than search date, print all lines from here on
elsif ($ThisLine =~ m/^\d{2}(\d{6}):/) {
if ($1 gt $datepart1) {
print $ThisLine;
$outcount++;
$all = 1; }
}
}
}
|