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?

link|improve this question
feedback

1 Answer

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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.