|
Ping text file of ip addressese and output to text file
I am basically a scripting noob, I have some programming logic, and I wouldn't post here if my 3 hours of searching actually found something.
So far this is what I have:
"
#! /bin/ksh
List=./pinglist1.txt
cat $List | while read ip
do
Pingable=""
ping $ip -n 2 | awk '/100%/ {print "no"}' |read Pingable
if [[ "$Pingable" != "no" ]]
then
print $ip "PINGS">>pingresults.txt
else
print $ip "DOESN'T PING">>pingresults.txt
fi
done
"
pinglist1.txt is just a plain file with IP addresses.
I just want the script to ping each IP address and report if it is pinging or not to a text file.
Please and thanks.
|