gibney.org
:
Technology
:
Linux
:
find files that contain string1 but not string2
(Entry Nr. 1686, by user 1 |
edit
)
find . -name '*.txt' -exec awk '/string1/{f=1}/string2/{c=1;exit}END{exit !f ||c }' {} \; -print <br> <br>other ways that could work: <br> <br>find . -name *.php | xargs grep -l string1 | xargs grep -L string2 <br> <br>find . -name '*.php' -exec bash -c 'grep string1 "$1" && grep string2 "$1" || echo "$1"' _ {} \;
Create a new entry at this position