I have two files with the following structure.
File A:
asd fds sdf asdf File B:
asd sdf I want to find the difference between these two files.
This time the result should be fds, asdf.
How can I do it with c++ or linux?
I have two files with the following structure.
File A:
asd fds sdf asdf File B:
asd sdf I want to find the difference between these two files.
This time the result should be fds, asdf.
How can I do it with c++ or linux?
diff A B returns
2d1 < fds 4d2 < asdf diff -u, but yes, diff is a very useful program that all *nix users should be aware of.This answer was posted by @sflee in his question. It was moved into this answer block.
Solution:
Here is the way I used finally, just in case that I forget this in the future. I got A.txt and 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