user1416227
user1416227

Reputation: 676

finding lines that Don't match a given pattern

I have a large file and I want to print the lines that do not match a particular undesired pattern. The following does the exact opposite of what I want, namely it retains all the undesirable lines.

grep -e '\[0.0, 0.0\]' locscore.txt

How can I get the lines that DON'T have the above pattern? I tried

grep -e '^*(?!\[0.0, 0.0\])*$' locscore.txt

but it produces nothing.

Upvotes: 0

Views: 169

Answers (1)

Kent
Kent

Reputation: 195289

if you use grep, there is an option -v, it does what you need.

from man page:

  -v, --invert-match
              Invert the sense of matching, to select non-matching lines.  (-v is specified by POSIX.)

Upvotes: 3

Related Questions