On Mon, 5 Dec 2005, Ron McKeever wrote:
> 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/;
> }
> }
> }
@file = <>;
foreach (11..$#file) {
chomp;
print $_ . "\n" ;
}
thx
.dave
http://www.davidsudjiman.info
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>