Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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