我碰巧这几天比较空,我认为楼主应该自己分析一下,这个真的不难,要知道人家写东西,不管怎样,都要花时间和精力,近来看到的只是问这个咋整,那个咋整,难道分析下日志文本真的很难吗?我对批也不是很精通的,都是平日在实践中积累的。其实像批这类,花上两个星期基本就搞顶了,比什么c、java简单多了。
罗嗦了几句,请楼主包含,但确实有点有感而发。
就楼主最新的结果文件,大概写了下- @echo off
- cd.>oo.txt
- for /f "delims=:" %%a in ('findstr /n "statistics" 1.txt') do echo %%a>>oo.txt
- for /f %%l in (oo.txt) do call :Readfi %%l 4 1.txt
- goto :eof
-
- :Readfi _fir _la _fi
- set /a s=%1-1
- SetLocal ENABLEDELAYEDEXPANSION
- set first="skip=%s% tokens=*"
- set last=%2
- set loop=0
- for /f %first% %%a in (%3) do (
- if not defined finished (echo %%a&set /a loop+=1) else (goto :end)
- if "!loop!"=="%last%" set finished=Nothing
- )
- :end
- endlocal
- @echo ===========================
- :eof
复制代码 得到如下结果,不知道达到要求了吗?
Ping statistics for 202.101.115.55:
Packets: Sent = 100, Received = 100, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 75ms, Maximum = 77ms, Average = 75ms
===========================
Ping statistics for 202.96.96.68:
Packets: Sent = 100, Received = 100, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 51ms, Average = 50ms
===========================
Ping statistics for 202.101.224.68:
Packets: Sent = 100, Received = 100, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 55ms, Maximum = 117ms, Average = 55ms
===========================
Ping statistics for 202.100.192.68:
Packets: Sent = 100, Received = 100, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 41ms, Maximum = 42ms, Average = 41ms
===========================
Ping statistics for 202.98.96.68:
Packets: Sent = 100, Received = 96, Lost = 4 (4% loss),
Approximate round trip times in milli-seconds:
Minimum = 66ms, Maximum = 154ms, Average = 71ms
===========================
Ping statistics for 202.102.154.3:
Packets: Sent = 100, Received = 100, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 44ms, Maximum = 80ms, Average = 44ms
===========================
Ping statistics for 202.98.192.68:
Packets: Sent = 100, Received = 100, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 100ms, Maximum = 104ms, Average = 100ms
===========================
Ping statistics for 59.175.249.226:
Packets: Sent = 100, Received = 97, Lost = 3 (3% loss),
Approximate round trip times in milli-seconds:
Minimum = 93ms, Maximum = 98ms, Average = 96ms
=========================== |