How can I exclude lines containing a match found with Ripgrep?

Viewed 1475

I am using rg (or alternatively ag) to search for occurrences of a string in a folder with many files, like this:

$ rg "cat"
lolo
3:cat

lala
2:cat

Now I would like to get rid of these matches.

How can I remove each line containing a match from every file with matches?

2 Answers

its rg -v 'pattern'.
Same as that of grep

Use -v argument, as example:

rg -v "cat" test.log

Result

1:lolo
3:
4:lala
Related