Find everything that DOES NOT MATCH a specific string #2494
-
Hello everyone I am working in .NET codebase and I want to find all namespaces that do not star with For example, say I have a 100 C# code files, and most have their namespace declaration as:
But a few had:
I want to ripgrep to list those that do not have the namespace How do I go about achieving that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
There may be a more efficient way, but something like this might work: rg '^namespace[[:space:]]+' . | rg -v 'ProjectX' |
Beta Was this translation helpful? Give feedback.
-
I would probably do something like |
Beta Was this translation helpful? Give feedback.
I would probably do something like
rg '^namespace ' | rg -v ProjectX
and see how that works.