Find keyword and export

I was trying to do any keyword search against all files in a particular folder, and interested in finding, an particular "keyword" whether present, if it present I need to export that file to an new folder. How to do it , via simple script ?

Post your attempts at solving this problem and mention the place where you are stuck.

Hi There,

Run these in your folder .....


mkdir destFolder
cp $(grep -ilr keyword *) destFolder

regards,

Steven M

Thanks Steven, you supply awesome.

I would like to add something more with my question.

I have any keyword file,
#cp ${grep -f keywordfile -l temp/} destFolder

Its working so good. But what trying to do is if the keywordfile has lets say keyword "demo" got more wc -l more than 2times , then copy it. How to do that ?