1
2
3
4
5
6
7
|
#!/bin/bash
#批量查找ip地址所在地
while
read
i
do
sring=`curl -s
"http://ip138.com/ips138.asp?ip=${i}&action=2"
| iconv -f gb2312 -t utf-8|
grep
'1.'
|
awk
-F
'[<> ]+'
'{print substr($7,7)}'
|
grep
-
v
"^$"
|
sed
-n
'4p'
`
echo
$i $sring
done
<
/etc/ip
.txt
|
本文转自 Anonymous123 51CTO博客,原文链接:http://blog.51cto.com/woshitieren/1679797