# MacOS – Automatically deleting files that contain a specific content

deletingfilefindermacosterminal

I would like to make use of the command that looks for a specific phrase in a file:

grep -lr "text to find" *


provided here and delete all of the found files. How can I generate the relevant terminal command?

rm $(grep -lr "text to find" *)  The $(..) runs the command within the parenthesis and uses its output as arguments for rm.