I'd like to take the csearch output and color it. It looks like so:
/home/bp/whatever.txt:1:foo
And this works:
csearch -n -- $term \
| env GREP_COLORS='mt=02;35' grep --color=always -P '^[^:]+:[^:]+:' \
| grep -P --color=always -- $term \
| less -RFX
However, it waits for the full output of csearch
to be computed before anything is shown.
Now, if I do this:
csearch -n -- $term \
| env GREP_COLORS='mt=02;35' grep --color=always -P '^[^:]+:[^:]+:' \
| pv
| grep -P --color=always -- $term \
| less -RFX
...I can see the data flowing, but if I do this:
csearch -n -- $term \
| env GREP_COLORS='mt=02;35' grep --color=always -P '^[^:]+:[^:]+:' \
| grep -P --color=always -- $term \
| pv
| less -RFX
...no data is flowing. The second grep
seems to be waiting for an EOF.
Adding --line-buffered
to both grep's seems to be doing me no good.
Why is this command pipe waiting for EOF?