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?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Assuming you want to delete them without further ado, use
rm $(grep -lr "text to find" *)
$(..) runs the command within the parenthesis and uses its output as arguments for