一个文本文件内有重复行,把多余的删掉,另存。
linux的uniq是多么的四两拨千斤:
uniq 1.txt result.txt
两个文件:2是1的子集,求交集1-2=?。
cat轻松搞定:
cat 2.txt 1.txt | sort | uniq -u > result.txt
grep也可以,就是得带几个参数,多操了些心:
grep -F -v -f 2.txt 1.txt | sort | uniq > result.txt
2.txt 1.txt的顺序很重要。
linux的uniq是多么的四两拨千斤:
uniq 1.txt result.txt
两个文件:2是1的子集,求交集1-2=?。
cat轻松搞定:
cat 2.txt 1.txt | sort | uniq -u > result.txt
grep也可以,就是得带几个参数,多操了些心:
grep -F -v -f 2.txt 1.txt | sort | uniq > result.txt
2.txt 1.txt的顺序很重要。
Niushop电商系统
开牛店的第一选择
性价比之王
转载于:https://www.cnblogs.com/niuniuniuniu/p/niu.html