Grep only shows last match

Posted by Bannix on Ask Ubuntu See other posts from Ask Ubuntu or by Bannix
Published on 2012-09-23T21:09:00Z Indexed on 2012/09/23 21:49 UTC
Read the original article Hit count: 239

Filed under:
|
|

I've got a problem with grep. When I use it as followed, it only shows the last match in every line and what follows after it.

For example:

If I use

tail -F example.log | grep -a -i -e "word1" -e "word2" -e "word3"

and example.log contains

word1 this word2 is word3 a test  

only "word3 a test" will be displayed. How can I display the whole line and not only the last matched string in a line + rest of the line?

I hope you can understand what I mean and help me :)

Greetings, Bannix

© Ask Ubuntu or respective owner

Related posts about kubuntu

Related posts about grep