I'm having problems with grep filtering of make output. In particular,
make target 2>&1 | grep -E --color=never "^make.*"
works as expected, but the following will print no output to the console:
make target 2>&1 | grep -E --color=never "^make.*" | cat
Am I missing something obvious? Why does the first command output but not the second? Is it to do with some sort of IO buffering? Or am I just being stupid?
[EDIT]: cat
is just a minimum test case placeholder for the actual command I want to use.
[EDIT]: This does not seem to be a problem with grep, as replacing it with ack leads to the same behaviour.
[EDIT]: Script that cat is a placeholder for:
#!/bin/bash
cat - \
| grep -E --color=never "^.*warning:.*|^.*error:.*|^make.*[Ee]rror.*|^make.*" \
| hilite.sh -r "^.*warning:.*" -f yellow -B \
| hilite.sh -r "^.*error:.*" -f red -B \
| hilite.sh -r "^make.*[Ee]rror.*" -f red -B \
| hilite.sh -r "^make.*" -f magenta
[EDIT]: I think it's a buffering/IO issue. I'm leaving the build running over the w/e and will see if it eventually gets the output where it needs to!