So, I understand that by using 'tee' I can redirect the output of a command such as 'ping' to stdout as well as a file.
For example:
> ping google.com | tee somefile
This would display the ping statistics on terminal and write them to 'somefile'.
Now, if I wish to modify the output from 'ping', I can use 'cut' in such a way:
> ping google.com | cut -d' ' -f 1
But, if I wish to use all the three commands together, I get a no output on stdout and an empty file.
> ping google.com | cut -d' ' -f 1 | tee somefile
What am I doing wrong? Is there a better way to do this? Somehow I feel I am not using 'tee' properly. Any insight would be appreciated.
I'm using bash shell, if this is relevant.
stdbuf
works perfectly.