时间:2021-02-26 10:54:25 | 栏目:Windows | 点击:次
rem 将IP提取到ip.txt文件
awk.exe "{a[$1]+=1;}END{for(i in a){print i;}}" 20120917.txt > ip.txt
rem 逐行读取ip.txt文件中的IP,并调用youdao.com的ip地址源查询接口
del result.txt
del last.txt
del last.csv
for /f "delims=" %%k in (ip.txt) do (
set /a b+=1
wget-1.10.2.exe "http://www.youdao.com/smartresult-xml/search.s?type=ip&q=%%k" --output-document=temp.xml >nul 2>nul
echo 正在处理%%k
for /f "delims=" %%i in (temp.xml) do (
set /a num+=1
set str=%%i
set str1=">%%k,!str!<"
if !num! equ 5 (echo !str1! | strrpc "<location>" "" | strrpc "</location>" "">> result.txt)
)
set num=0
)
rem 处理result.txt引号
for /f "tokens=2 delims=>" %%z in ('type result.txt') do (
for /f "delims=<" %%z in ("%%z")do echo %%z >> last.txt
)
rem 将last.txt命名为last.csv
rename last.txt last.csv
pause