#!/bin/bash
#get ip souce
SAVEFILE=ipaddress.txt
for i in `cat ip.txt`
do
wget http://www.ip168.com/ip/?ip=$i &>/dev/null
address=`cat index.html\?ip\=$i | grep 本站主数据|sed 's/<div>.*:\(.*\)<.*>/\1/'`
if [ "$address" == "" ];then
echo -n "Failed get $i source,please check..."
fi
echo "$i$address" >> $SAVEFILE
rm -rf index.html\?ip\=$i
done
echo "All work done."