Act on files containing a matching string

Quite often it's not enough to simply find files that contain a certain string as you also want to do something with those files once found.

grep -Z -l find_me . | xargs --null -I{} mv -iv {} ../elsewhere/

In the event that some of all of the files are compressed, you can use one of the grep commands that also de-compresses before searching. I found that some of these programs don't handle the NULL ending all that well:

zgrep
bzgrep
xzgrep
 
eg.
bzgrep -l find_me_too . | xargs -I{} mv -iv {} ../elsewhere/