Regular expression incorporating an exclusion (ie "does not contain") for grep

Posted by Nick G on Stack Overflow See other posts from Stack Overflow or by Nick G
Published on 2010-03-26T11:55:29Z Indexed on 2010/03/26 12:03 UTC
Read the original article Hit count: 301

Filed under:
|
|

I'm trying to filter webserver log files using grep. I need to output all lines containing 65.55. but exclude those matching lines which contain msnbot.

My starting point is this - but it doesn't work:

grep "^.*65\.55\..*(!msnbot).*$" ex100101.log > results.txt

I'm using grep for Windows (hence double quotes) but I doubt this matters.

© Stack Overflow or respective owner

Related posts about grep

Related posts about regex