How to use negative regex matching with grep -E? -


this question has answer here:

i'm using following regex via grep -e match specific string of chars via | pipe.

$ git log <more switches here> | grep -e "match me" 

output:

match me once match me twice 

what i'm looking negative match (return output lines don't contain specified string following grep doesn't it:

$ git log <more switches here> | grep -e "^match me" 

desired output:

whatever 1 whatever 2 

here full output comes command line:

match me once match me twice whatever 1 whatever 2 

how arrive @ desired output per negative regex match?

use -v option inverts matches, selecting non-matching lines

grep -v 'match me' 

another option use -p interprets pattern perl regular expression.

grep -p '^((?!match me).)*$' 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -