Hi,
I need to find a word in a file, and I need to delete the file where the word resides on the file.
I did try with the grep -H "word" using the find command, but no luck.
Hi,
I need to find a word in a file, and I need to delete the file where the word resides on the file.
I did try with the grep -H "word" using the find command, but no luck.
so how did you use them? show your code
find . -type f -exec grep -H -R "word" {} \; | xargs rm -rf
Try:
find . -type f -exec grep -l "word" {} \; | xargs rm -rf
Jean-Pierre.
find . -type f -exec grep -w "word" {} \; -print | grep "^./" | xargs rm -rf
Hi,
Thank you all, the below command worked a lot
find . -type f -exec grep -w "word" {} \; -print | grep "^./" | xargs rm -rf
The below command removed the word in the file and not removing the file containing the word.
find . -type f -exec grep -l "word" {} \; | xargs rm -rf
Thank you..
Can you explain what this grep "^./" command used for , what does it do?