Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ping website.com -n 3 | grep Minimum
会告诉你
Minimum = 24ms, Maximum = 62ms, Average = 36ms
我要添加什么来修剪除最小 ping 之外的所有内容?只让它输出“24”?
您可以通过管道输出pinginto sed:
ping
sed
sed 's/Minimum = \([0-9]\+\)ms.*/\1/'
或者,如果您有GNU grep,请输入:
GNU grep
grep -oP "(?<=Minimum = )[0-9]+(?=ms)"