How to compare two huge text files (more than 50gb each)?

sara picture sara · Apr 12, 2016 · Viewed 15.1k times · Source

I have 2 huge text files and want to find the difference between them? What is the fast command/ utility/ or script to do this job?

I try using unix diff but, it failed for huge files. It show me "Permission Denied"

Also, I try unix bdiff (as I read that is good for huge files) but, I did not complete test it because it show me "bdiff: command not found"

Also, I try windows FC (file compare) but, I did not know how to show the output in a new text file. The result output in the cmd and I can't figure it all.

Any suggestion will help me a lot. Please help me in this matter.

Thanks a lot.

Answer

SLePort picture SLePort · Apr 12, 2016

You can try diff with the --speed-large-files option :

diff --speed-large-files file1 file2

cmp is another alternative (compare files byte by byte) :

cmp file1 file2