How to delete all files containing the specified text?

grep -l <text> * | xargs rm

stackoverflow.com/a/4529141

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

Another solution:

find . -exec grep -q 'text' '{}' \; -delete

stackoverflow.com/a/4529188

It can be preliminary checked as:

find . -exec grep 'text' '{}' \;

The \ character in text should be doubled, e.g.:

find . -exec grep 'Magento\\Framework\\App\\Http::handleBootstrapErrors(): Failed opening required' '{}' \;