Skip to content

--invert-match works only on lines and not with filenames. is that supposed behaviour? #1795

Answered by BurntSushi
saifali-ch asked this question in Q&A
Discussion options

You must be logged in to vote

There isn't enough info here to precisely answer. Assuming that Shortcuts.txt has at least one line that contains below, then the output is correct. --invert-match inverts matching in a line oriented way. That is, a matching line is any line that doesn't match the pattern. Thus, any file that contains any line that doesn't match the pattern is considered a matching file by --files-with-matches.

This is why the --files-without-match flag exists. It is likely what you want here.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@saifali-ch
Comment options

Answer selected by saifali-ch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants