Operation Instructions: 20120917.txt is required to analyze the log, Last.csv is the statistical results (using EXECL open, convenient statistics, sorting).
1. [Document] Awk.zip
2. [Picture] run screenshots. jpg
3. [Picture] Run result
4. [Code] Save as Bat double-click to open
Copy Code code as follows:
@echo off
Setlocal enabledelayedexpansion
REM Extracts IP to ip.txt file
Awk.exe "{a[$1]+=1;} End{for (i in a) {print i;}} " 20120917.txt > Ip.txt
REM reads IP in ip.txt file line-by-row and invokes youdao.com IP address source query interface
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's processing%%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 Processing Result.txt Quotes
for/f "tokens=2 delims=>"%%z in (' Type Result.txt ') does (
for/f "delims=<"%%z in ("%%z") do echo%%z >> last.txt
)
REM names Last.txt as Last.csv
Rename Last.txt last.csv
Pause