我试图通过Linux CLI在文件中查找邮箱地址来删除错误的邮箱.
我可以用它来获取文件
find . | xargs grep -l email@domain.com
但是我不知道如何从那里删除它们,因为下面的代码不起作用.
rm -f | xargs find . | xargs grep -l email@domain.com
谢谢你的帮助.
我试图通过Linux CLI在文件中查找邮箱地址来删除错误的邮箱.
我可以用它来获取文件
find . | xargs grep -l email@domain.com
但是我不知道如何从那里删除它们,因为下面的代码不起作用.
rm -f | xargs find . | xargs grep -l email@domain.com
谢谢你的帮助.
为了安全起见,我通常通过管道将find的输出传输到类似awk的东西,并创建一个批处理文件,每一行都是"rm filename"
这样,您可以在实际运行它之前判断它,并手动修复任何难以使用正则表达式的奇数边缘情况
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