Board logo

标题: [文本处理] [已解决]批处理怎么统计某一文件中“timed out” 次数? [打印本页]

作者: shi981    时间: 2015-6-8 20:58     标题: [已解决]批处理怎么统计某一文件中“timed out” 次数?

有一个文本1.txt 内容如下:
怎么统计 timed out 的次数

Reply from 111.13.100.114: bytes=32 time=23ms TTL=50
Request timed out.
Reply from 111.13.100.114: bytes=32 time=34ms TTL=50
Reply from 111.13.100.114: bytes=32 time=28ms TTL=50
Reply from 111.13.100.114: bytes=32 time=23ms TTL=50
作者: mqyphts    时间: 2015-6-8 21:07

  1. @echo off
  2. type "1.txt" | find /c "timed out"
  3. pause
复制代码

作者: yangfengoo    时间: 2015-6-8 21:10

  1. @echo off
  2. for /f "tokens=2 delims=:" %%a in ('find /c "timed out" 1.txt') do echo,timed out %%a次
  3. pause
复制代码

作者: Batcher    时间: 2015-6-8 21:37

  1. find /c "timed out" < 1.txt
复制代码

作者: shi981    时间: 2015-6-8 23:29

在网上找到了。谢谢大家
find /c "timed out"  1.txt




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2