I\'m trying to make a script that will live watch some logs. I have a log of requests with each request formatted something like this,
---
id=273482
Result=Error
GNU awk has a fflush() you can use to flush buffers:
.. | awk 'BEGIN { RS = "---" } /Error/ { print; fflush(); }' | ..
With this you've line buffered all the stages in the pipeline.
If you in the future have any other programs in the pipeline that don't support something like awk fflush, grep --line-buffered or sed -u, GNU coreutils has a more general stdbuf you can use with any program:
.. | stdbuf -o 0 any_other_command | ..