我试图写一个shell脚本来消除重复的文件,但我很早就被卡住了……
find $1 -type f -exec md5sum {} + > /tmp/$$
find $1 -type f -exec md5sum {} + | sort | awk '{print $1}' | uniq -d > \
/tmp/$$.spec此时,/tmp/PID保存MD5 (空格)文件名,/tmp/PID.spec保存重复的散列。如何在/tmp/PID中搜索每个重复的散列?
cat /tmp/$$ | grep /tmp/$$.spec不返回任何结果,但我认为这将逐行遍历我的整个文件,并且只返回与.spec文件中的散列匹配的行。显然不是。
发布于 2013-03-03 11:30:15
grep -f /tmp/$$.spec /tmp/$$
使用-f选项即可完成此工作
https://stackoverflow.com/questions/15182026
复制相似问题