extract average time from ping -c extract average time from ping -c bash bash

extract average time from ping -c


One way is to just add a cut to what you have there.

ping -c 4 www.stackoverflow.com | tail -1| awk '{print $4}' | cut -d '/' -f 2


ping -c 4 www.stackoverflow.com | tail -1| awk -F '/' '{print $5}' would work fine.

"-F" option is used to specify the field separator.


This might work for you:

ping -c 4 www.stackoverflow.com | sed '$!d;s|.*/\([0-9.]*\)/.*|\1|'