Windows命令行,如何用管道过滤

时间:2015-10-26 15:34:06

标签: windows powershell command-line grep

我尝试使用管道在Windows命令行中过滤ping stats。我想要的是获得时间'每个ping。

"ping -n 1 -w 1000 " + ip   

打印

Pinging 216.52.241.254 with 32 bytes of data:
Reply from 216.52.241.254: bytes=32 time=82ms TTL=240

Ping statistics for 216.52.241.254:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 82ms, Maximum = 82ms, Average = 82ms

我正在寻找的输出只是82

我对findstr "ping -n 1 -w 1000 " + ip + ' | findstr time=[0-9]*'的尝试打印:

Reply from 216.52.241.254: bytes=32 time=83ms TTL=240

这次输出应该是83

我尝试过使用grep ?("time=")[0-9]*ms,但在该行之上可能不对,我不认为windows grep包含条件

0 个答案:

没有答案