#!/bin/ksh #Ping all the hosts on the local network. Let's see who answers. #Get the broadcast address of this network. address=`/sbin/ifconfig -a | awk '$5 == "broadcast" {print $6}'` #Cut the ping off after the first round of answers. /usr/sbin/ping -s $address | awk ' NR > 1 { if ($0 ~ /icmp_seq=0\./) { print } else { exit 0 } } ' | #Remove everything except the IP address of each host that answered. sed -n 's/.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/p'