This question already has an answer here:
Say, I have some files, and I want to find the files among them which contain a string but do not contain another.
grep being line based, conditions such as
grep -q printf file && grep -vq '#include <stdio.h>' file will not work.
How should I go about doing this?
(I am on Debian, so answers specifically targeted at GNU versions of tools are fine.)