I want to get only the number of ms from a ping command to a file Without piping to a file it works as intended. I'm a little bit lost on why > to a file does not write anything.
This works:
ping 192.168.1.1 |egrep --line-buffered -v 'PING|timeout' |sed -l -e 's/^.* time=\(.*\) ms$/\1/g'
This does not write anything to ping.dat
ping 192.168.1.1 |egrep --line-buffered -v 'PING|timeout' |sed -l -e 's/^.* time=\(.*\) ms$/\1/g' > ping.dat
What am I doing wrong?
--line-buffered
with egrep solve this? Or does grep's output then also get buffered? – Otheus Feb 16 '16 at 13:56stdbuf -o0
does solve the problem, it appearssed
uses stdio and the stream gets stuck in itsstdout
's output buffer. – Petr Skocik Feb 16 '16 at 14:04-u
also does this. – Otheus Feb 16 '16 at 14:22