Hello,
I would like to skip the first ten lines of output from tail, then print any
new records matching my array, but I seem to be stuck, below will run but
nothing prints:
tail /var/log/messages is piped to it...
#!/usr/bin/perl
my @names = ("nb","tp","ape","berry","jab");
my $log = "/local/tp/tp";
#skip first ten
@array = ( 1 .. 10 );
while ($line = <>) {
foreach $number ( @array ) {
($mo, $day, $tm, $host, $proc, @data) = split(" ", $line);
foreach my $i (@names){
print "Seen on ". localtime() .": $line" if $host =~ /$i/;
}
}
}
Thanks,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>