NET=192.168.7 for IP in $(seq 1 254); do REV=$( nslookup $NET.$IP | grep 'name =' | cut -d'=' -f2) PING=0 ping -c1 -w1 $NET.$IP 2>&1 > /dev/null && PING=1 echo $NET.$IP $REV $PING done