I am interested in recursively grepping for a string in a directory for a pattern and then cp'ing the matching file to a destination directory. I thought I could do something like the following, but it doesn't seem to make sense with linux's find tool:
find . -type f -exec grep -ilR "MY PATTERN" | xargs cp /dest/dir
Is there a better way of going about this? Or a way that even works would be a solid start.