编辑代码

result = "ping -s 48 -c 3 -a 69.194.169.197 69.194.169.198  PING 69.194.169.198: 48  data bytes, press CTRL_C to break    Reply from 69.194.169.198: bytes=48 Sequence=1 ttl=64 time=197 ms    Reply from 69.194.169.198: bytes=48 Sequence=2 ttl=64 time=197 ms    Reply from 69.194.169.198: bytes=48 Sequence=3 ttl=64 time=197 ms  --- 69.194.169.198 ping statistics ---    3 packet(s) transmitted    3 packet(s) received    0.00% packet loss    round-trip min/avg/max = 197/197/197 ms <CN-HKG-MEG-C-1.GNET>"

result = result.replaceAll(/\r/, "")
result = result.replaceAll(/\n/, "")


def regex = "round-trip min/avg/max(/stddev)? = (\\d+(.\\d+)?)/(\\d+(.\\d+)?)/(\\d+(.\\d+)?)"
def matcher = result =~ regex
if (matcher.find()) {
    println "${matcher.group(2)}"
}else{
    retunr ""
}