1

I'm just trying to get grep to show all the lines, but the ones that match should have the matching text colored. Specifically I need this for something like this:

tail -f file.log | grep --color Exception

Unfortunately I don't see any option in grep that would simultaneous show the not matching lines and the lines that match (with color). Is there any other tool for this in unix/linux that would allow this?

1 Answer 1

1

One work-around would be to use the context option with a large line count:

tail -f file.log | grep -C 1000 --color Exception

If you have ack it has an option for this:

tail -f file.log | ack --color --passthru Exception

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .