如何找到含有字符串A同时不含字符串B的文件

find . -type f -name "*.c" \( -exec grep -q "A" {} \; ! -exec grep -q "B" {} \; \) -print

 

Leave a Reply

Your email address will not be published. Required fields are marked *