#! /bin/sh CSfile=CSHosts`date '+%m%d%y_%H%M%S'` Otherfile=OtherHosts`date '+%m%d%y_%H%M%S'` IPDerviedfile=IPDerivedHosts`date '+%m%d%y_%H%M%S'` Pingablefile=PingableHosts`date '+%m%d%y_%H%M%S'` rm -f $CSfile touch $CSfile rm -f $Otherfile touch $Otherfile rm -f $IPDerviedfile touch $IPDerviedfile rm -f $Pingablefile touch $Pingablefile HostName="" HostIPaddr="" j=1 while test $j -le 255 do i=1 while test $i -le 255 do HostIPaddr=128.82.$j.$i echo testing $HostIPaddr host $HostIPaddr | grep name > answer if test $? -eq 0 # is a valid host name then HostName=` cat answer | awk '{print $5}'` timeoutcmd 1 ping $HostIPaddr | grep alive > /dev/null if test $? -eq 0 # is pingable host then echo "$HostIPaddr ($HostName)" >> $Pingablefile fi if echo $HostName | grep "\.cs\.odu\.edu" >/dev/null then # CS dept host echo "$HostIPaddr ($HostName)" >> $CSfile else if echo $HostName | egrep "\-$i|\-$j|$i\-|$j\-|\.$i|\.$j|$i\.|$j\." >/dev/null then #IP related host name echo "$HostIPaddr ($HostName)" >> $IPDerviedfile else echo "$HostIPaddr ($HostName)" >> $Otherfile fi fi fi i=`expr $i + 1` done j=`expr $j + 1` done