I am trying to grep the ongoing tail of file log and get the nth word from a line. Example file:$ cat > test.txt <<EOLBeam goes blahJohn goes heyBeam goes what?John goes forget itBeam goes okayBeam goes byeEOL^CNow if I do a tail:$ tail -f test.txtBeam goes blahJohn goes heyBeam goes what?John goes forget itBeam goes okayBeam goes bye^CIf I grep that tail:$ tail -f test.txt | grep BeamBeam goes blahBeam goes what?Beam goes okayBeam goes bye^CBut if I awk that grep:$ tail -f test.txt | grep Beam | awk '{print $3}'Nothing no matter how long I wait. I suspect it's something to do with the way the stream works.Anyone have any clue?
Piping from grep to awk not working
bash;grep;rhel;awk;tail
It's probably output buffering from grep.  you can disable that with grep --line-buffered.But you don't need to pipe output from grep into awk.  awk can do regexp pattern matching all by itself.tail -f test.txt | awk '/Beam/ {print $3}'