Here are some practical answers to your "theoretical" question.
tail
can do this for you
Example:
ping -c 10 8.8.8.8 | tail --lines=3 > output.file
the -c 10 switch in the ping command limits the pings to 10 rather than continuing indefinitely which is the default. the lines=3 switch in the tail command limits output to the last 3 lines which is what we really care about usually.
This will result in only the summary (last 3 lines) as shown below:
--- 8.8.8.8 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9014ms
rtt min/avg/max/mdev = 22.810/25.120/31.137/2.936 ms
If for some odd reason you truly want the output of a single ping just modify the above to ping -c 1 8.8.8.8 | head --lines=2 | tail --lines=1 > output.file
Resulting in:
64 bytes from 8.8.8.8: icmp_seq=1 ttl=45 time=24.0 ms
Edit: Continuous single ping As requested in comment:
while :; do ping -c 1 8.8.8.8>output.file; sleep 1; done
Since while : always evaluates as true this will loop indefinitely, running ping and redirecting the output to output.file, overwriting it each time the loop runs. It pauses for a second with each iteration in order to allow you time to read the output.
You can experiment with sleep values below a second such as 0.5 or 0.01 but at some point you will have too short a delay between writes and be back where you started.
Sources:
man ping
man tail
Experience
https://www.cyberciti.biz/faq/bash-infinite-loop/
http://www.linuxforums.org/forum/programming-scripting/70966-possible-sleep-less-than-1-sec-simple-bash-script.html
tail
comes to mind. Seeman tail