Reputation: 1719
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?
Upvotes: 2
Views: 3448
Reputation: 102444
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
Upvotes: 0