Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Works fine for me. What do you get after 30 seconds? – Eran Ben-Natan 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
up vote 3 down vote accepted

Try this instead ;)

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

Must be something about how ping terminates lines.

share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .