Bash等号后如何获取子字符串

时间:2019-03-18 05:02:00

标签: string bash

因此,我从ping的

行得到了输出
PING www.google.com (172.217.10.4) 56(84) bytes of data.
64 bytes from lga34s12-in-f4.1e100.net (172.217.10.4): icmp_seq=1 ttl=54 time=6.58 ms
64 bytes from lga34s12-in-f4.1e100.net (172.217.10.4): icmp_seq=2 ttl=54 time=9.07 ms
64 bytes from lga34s12-in-f4.1e100.net (172.217.10.4): icmp_seq=3 ttl=54 time=6.77 ms
64 bytes from lga34s12-in-f4.1e100.net (172.217.10.4): icmp_seq=4 ttl=54 time=13.8 ms
64 bytes from lga34s12-in-f4.1e100.net (172.217.10.4): icmp_seq=5 ttl=54 time=6.68 ms

--- www.google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 6.583/8.592/13.848/2.786 ms

我想提取time=之后显示的值,这样我将得到类似以下的输出:

5.58
9.07
6.77
13.8
6.68

最好的方法是什么?

0 个答案:

没有答案