I'm trying to have grep search inside specified files that are returned by find:
find . -type d -name 'mydir*' -exec find '{}' -name '*.java' \; | grep 'MyClass'
This doesn't work.
Meanwhile, this works.
grep 'MyClass' $(find . -type d -name 'mydir*' -exec find '{}' -name '*.java' \;)
What's the problem with my first example?