0
我想寫一個shell腳本,以消除重複的文件,但我得到了早期堅持...grep的在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文件的散列匹配線。顯然不是。
可能重複:在UNIX中取出相同的文件(http://stackoverflow.com/questions/2400574/remove-identical-files- in-unix/2400784)和[在終端中檢查重複?](http://stackoverflow.com/questions/621708/checking-duplicates-in-terminal) – 2013-03-03 09:34:02