#!c:/perl/bin/perl -w # Windows doesn't have it # Tail and grep program # use strict; my $file = $ARGV[0] || printUsage(); my $gs = $ARGV[1]; my $filesize = 0; open (FH,$file) || die "Unable to open $_: $!"; seek (FH,0,2); if (tell(FH) >=1500) { seek(FH,-1500,2); } else { seek(FH,0,0); } while (1) { while () { if ($gs) { if ($_ =~ /$gs/o) { print $_; } } else { print $_; } } seek(FH,0,1); sleep (1); } sub printUsage { die "USAGE: ptail.exe [grep string]"; } =head1 NAME ptail.pl - A simple tail and grep program. (I was working on NT at the time and needed this) =head1 SYNOPSIS ptail.pl [grep string] =head1 DESCRIPTION This is a goofy little tool helpful for tailing (and grepping) logfiles. =head1 AUTHOR bizzach, Ewbs@lookiloo.netE =head1 SEE ALSO L. =cut