How can I remove all the files which has a string in a file

Posted by michael on Super User See other posts from Super User or by michael
Published on 2010-05-08T05:43:54Z Indexed on 2010/05/08 5:48 UTC
Read the original article Hit count: 277

Filed under:
|

Hi,

I am trying to remove all the files in a directory hierarchy which a certain string inside the file (not the file name, it is the file content).

I can list out all the file name which has a string in the file using 'grep -r -l mystringlooking for'.

But how can I remove all the files returned by the grep ? I am trying this on ubuntu.

Thank you.

© Super User or respective owner

Related posts about linux

Related posts about ubuntu