how to search only for files with a specific extension OR no extension at all? #2355
-
Not sure if this is possible, but came to ask. Create 3 files:for f in '' .sh .py ; do echo foo >foo$f ; done Try to search for
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
The answer is in the
So This is behaving as I would expect. It also matches the behavior you are seeking:
Indeed, the results of this would always be empty because "no extension" and ".py" are mutually exclusive. Presumably what you meant to say is "try to search for First, we must observe that globs are matched in order. (And this is documented by virtue of ripgrep's globbing semantics being "equivalent to gitignore." And as you might know, gitignore rules can override earlier ones.) The most recent one to match takes precedent. Since
But how to get
Veni vidi vici. |
Beta Was this translation helpful? Give feedback.
-
Got caught with another footgun today. I noticed that with the workaround above, some directories are being excluded. For example:
Not sure if there's any workaround for this case... |
Beta Was this translation helpful? Give feedback.
The answer is in the
--debug
output. It can be a little difficult to parse as it is mostly there to aide programmers, but all you need to do is look for the files you want to search: