derek3000 has asked for the wisdom of the Perl Monks concerning the following question:
any help would be much appreciated. Thanks, Derek---------------------------------------------------------------------- +----- #!/usr/bin/perl -w use strict; print "Please enter the third octet for scannin': "; my $octet3 = <>; chomp $octet3; open(LOG, ">log.txt") || die "Couldn't open log file: $! \n"; for(my $x = 0; $x < 20; $x++){ open(PINGIN, "ping 10.32.$octet3.$x -w 5 |") or die "Couldn't pull that one off: $! \n"; while(<PINGIN>){ warn "Logging activity for 10.32.$octet3.$x \n"; print LOG $_; } } close PINGIN; close LOG; open(LOG, "log.txt") or die "$!"; open(UNAVAILABLE, ">ips.txt") or die "$!"; while(my $line = <LOG>){ if($line =~ /^64 bytes from ([0-9.]):/){ my $ip = $1; print UNAVAILABLE "$ip is unavailable.\n"; } } close LOG; close AVAILABLE; --------------------------------------------------------------------
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: batch ping problem
by marcink (Monk) on Jun 13, 2001 at 19:18 UTC | |
Re: batch ping problem
by Henri Icarus (Beadle) on Jun 13, 2001 at 19:27 UTC | |
Re: batch ping problem
by derek3000 (Beadle) on Jun 13, 2001 at 19:40 UTC | |
Re: batch ping problem
by Anonymous Monk on Jun 13, 2001 at 22:54 UTC |