ping retries for unanswering nodes, which adds to the latency in reporting the availability of the nodes back to the console output, while the answered online nodes are reported immediately back. ping has this disadvantage that you need to execute it for every host.
Use fping, a better alternative to ping , which can do a parallel ping on the hosts, source is available at sourceforge http://fping.sourceforge.net/ . Download fping and install it under /usr/local/sbin and make it suid.
Here is a perl example, that can report the unreachable nodes at the end, while the nodes that are online are reported with their dns names, you can pass the output of this script to tools such as grep or awk again to work on the desired output.
#!/usr/bin/perl
require 'open2.pl';
use Net::IP;
$pid = &open2("OUTPUT","INPUT","/usr/local/sbin/fping -d");
@check=();
my $ip = new Net::IP ('98.137.149.56 - 98.137.149.100') || die "Unable to generate range\n";
do {
push (@check, $ip->ip());
} while (++$ip);
foreach(@check) { print INPUT "$_\n"; }
close(INPUT);
while(<OUTPUT>) {
print "$_";
}
close(OUTPUT);