If i have files like:
cat file1.txt
foo
bar
cat file2.txt
foo
baz
cat file3.txt
bar
baz
Is there a command on ripgrep (or similar) that will search for e.g. files containing foo and bar? E.g. it will display file1.txt but not the other two files? (note foo and bar might not be on the same line.)
And then second question, to get even more fancy, can I use some syntax to count files with foo but exclude them if they also contain bar? So e.g. it would only display file2.txt?
Thanks!
Because rg can be passed a list of files to search... You can just create a second search on the results of the first:
This searches for files that have both "bar" and "foo" in them.