"grep -l" can be used to get the list of files. Then you can use "xargs" to move the files, like this:

find . -type f | xargs -r grep -l "phrase" | xargs -r mv -t target-directory

Beware of special symbols in file names though. So this would be more appropriate if you are not sure about the file names:

find . -type f -print0 | xargs -0r grep -Z -l "phrase" | xargs -0r mv -t "target-directory"

source:
https://www.quora.com/How-can-I-use-grep-to-mass-move-all-files-that-contain-a-given-phrase-in-their-text