0

While trying melodyping, I noticed that

ping <host> |awk '{print $1}'

takes about 30 seconds until the first line is actually displayed. Even though w/o piping to awk each ping is returned in about 35 msec.

What causes that delay?

2
  • Works fine for me. What do you get after 30 seconds? Apr 18 '12 at 11:33
  • @EranBen-Natan After those 30s I get a bulk of expected output, i. e. lines from ping with times around 35ms.
    – DerMike
    Apr 18 '12 at 12:28
3

Try this instead ;)

while true; do ping -c 1 <host> | awk '{print $1}'; done

Must be something about how ping terminates lines.

2
  • 2
    Or possibly a lack of flushing. (which is just unhygienic imo)
    – Eroen
    Apr 18 '12 at 10:58
  • Nice work around. +1
    – DerMike
    Apr 18 '12 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.