Reputation: 3325
ping website.com -n 3 | grep Minimum
Will show you
Minimum = 24ms, Maximum = 62ms, Average = 36ms
What do I add to trim everything except the Minimum ping? To only make it output "24" ?
Upvotes: 1
Views: 72
Reputation: 54502
You could pipe the output of ping
into sed
:
sed 's/Minimum = \([0-9]\+\)ms.*/\1/'
Or if you have GNU grep
, pipe into:
grep -oP "(?<=Minimum = )[0-9]+(?=ms)"
Upvotes: 1