How do I recursively view a list of files that has one string and specifically doesn\'t have another string? Also, I mean to evaluate the text of the files, not the filenames.>
Here is a more generic construction:
find . -name -print0 | xargs -0 grep -Z -l | xargs -0 grep -L
This command outputs files whose name matches
(adjust find
predicates as you need) which contain
, but do not contain
.
The enhancements are:
If you don't need to filter by name (one often wants to consider all the files in current directory), you can strip find
and add -R
to the first grep
:
grep -R -Z -l | xargs -0 grep -L