I want to output all the lines in my source code which contain the string foo but don't contain the string bar. I tried this:
find . -name "*.[hc]pp" | xargs grep -n foo | grep -x bar
However this doesn't work as I expected. How can I use grep in this way?
