How to delete all files containing the specified text?

bash
command-line

(Dmitry Fedyuk) #1
grep -l <text> * | xargs rm

stackoverflow.com/a/4529141


(Dmitry Fedyuk) #2

A safier solution:

find . | xargs grep -l email@domain.com | awk '{print "rm "$1}' > doit.sh
vi doit.sh // check for murphy and his law
source doit.sh

stackoverflow.com/a/4529138