【发布时间】:2017-03-13 02:55:08
【问题描述】:
我运行以下代码来删除恶意软件,我想用管道对其进行扩展,以便它可以删除发现包含以下字符串的文件(删除结果由 grep 返回)。
grep -rnw . -e "ALREADY_RUN_1bc29b36f342a82aaf6658785356718"
它返回一个文件列表
./gallery.php:2:if (!defined('ALREADY_RUN_1bc29b36f342a82aaf6658785356718'))
./gallery.php:4:define('ALREADY_RUN_1bc29b36f342a82aaf6658785356718', 1);
./wp-includes/SimplePie/HTTP/db.php:2:if (!defined('ALREADY_RUN_1bc29b36f342a82aaf6658785356718'))
./wp-includes/SimplePie/HTTP/db.php:4:define('ALREADY_RUN_1bc29b36f342a82aaf6658785356718', 1);
./wp-includes/SimplePie/Parse/template.php:2:if (!defined('ALREADY_RUN_1bc29b36f342a82aaf6658785356718'))
./wp-includes/SimplePie/Parse/template.php:4:define('ALREADY_RUN_1bc29b36f342a82aaf6658785356718', 1);
./wp-includes/SimplePie/XML/file.php:2:if (!defined('ALREADY_RUN_1bc29b36f342a82aaf6658785356718'))
【问题讨论】:
-
尝试使用
-l选项到grep仅列出文件名。 -
@GregoryNisbet 如果我使用 -l,我如何使用 rm -rf 执行它