Delete a list of files with find and grep
问题 I want to delete all files which have names containing a specific word, e.g. "car". So far, I came up with this: find|grep car How do I pass the output to rm? 回答1: find . -name '*car*' -exec rm -f {} \; or pass the output of your pipeline to xargs : find | grep car | xargs rm -f Note that these are very blunt tools, and you are likely to remove files that you did not intend to remove. Also, no effort is made here to deal with files that contain characters such as whitespace (including