Pipe ‘tail -f’ to awk is not hanging… here is a solution to the problem.
Pipe ‘tail -f’ to awk is not hanging
Something like this hangs :
tail -f textfile | awk '{print $0}'
Grep
does not hang when used in place of AWK.
My actual intention is to add color to some log output using only standard commands; However, it seems that feeding tail -f
into awk
will not work. I don’t know if this is a buffer issue, but I’ve tried something that didn’t work, like:
awk '{print $0; fflush()}'
There are also How to pipe tail -f into awk
Any ideas?
Solution
I’m having almost the exact same issue as mawk. I think this is due to the way mawk flushes its buffer, and the problem disappears when I switch to gawk. Hope this helps (I know it’s a bit late).