find negation operator not working as expected
matt <[email protected]> Mon, 19 Sep 2011 12:24:31 -0700 (PDT)
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <ee3e5959-ce52-4e7d-ab51-c178b9513ad1@bi2g2000vbb.googlegroups.com> |
I'm trying to find all the files that don't contain a string in the
current directory. This incantation
find . -exec grep -l "foobaz" '{}' \;
will list all the files that contain "foobaz"; however, when I try to
invert this using any one of these incantations
find . ! -exec grep -l "foobaz" '{}' \;
find . \! -exec grep -l "foobaz" '{}' \;
find . -not -exec grep -l "foobaz" '{}' \;
I get the same output. What's going on here?
I'm using a bash shell on darwin Mac OS. The "find" utility I'm using
is the GNU variety built using MacPorts.
Thanks in advance.