views:

73

answers:

1

I'm saving the output of a command after redirecting its stdout, stderr and passing it through a pipe. Things seem to be working fine but I'm noticing a delay in bash screen update which is almost <= 37 seconds.

The same delay I see when checking output file with "tail -f output-ping.txt". I've never seen such a delay earlier even with ping nor I think this is happening cause of tee. Is this because of numerous redirections being performed? What are your thoughts! Thanks.

ping google.com 2>&1 | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }' | tee -a output-ping.txt

A: 

I tried it myself and needed to flush the awk stream, i dropped the str line, but I think there was no problem there

ping google.com 2>&1 | awk '{ print $0, fflush() }' | tee -a pepe.txt
YuppieNetworking
I see. Flushing the buffer helped! Thanks.
foofoo