Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个具有以下结构的文件。
档案一:
asd fds sdf asdf
文件 B:
asd sdf
我想找出这两个文件之间的区别。
这次结果应该是fds, asdf。
我怎样才能用 c++ 或 linux 做到这一点?
diff A B返回
diff A B
2d1 < fds 4d2 < asdf
这个答案是@sflee 在他的问题中发布的。它被移到这个答案块中。
解决方案:
这是我最终使用的方式,以防我将来忘记这一点。我得到A.txt了B.txt:
A.txt
B.txt
sort A.txt | uniq > A2.txt sort B.txt | uniq > B2.txt diff A2.txt B2.txt | grep '<' > data_B2_is_missing.txt