comparing UNIX files

I have 2 huge text files, each containing around 40million unique lines of text.

Is there any way of comparing the 2 files and returning only those lines that appear in one file but not in the other?
stummjAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

omarfaridCommented:
you may use different commands like diff , cmp, comm

Please man page for these commands on your system
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stummjAuthor Commented:
I considered diff but I think that does a line by line comparison and line 1 in file 1 may match (say) line 50,000 in file 2. So diff is out. I'll check the others though. Thanks
0
stummjAuthor Commented:
comm looks like it will work but I need to sort the files first.
Im guessing that using "sort" on a 40 million line file may take a long time. Is there a better way to sort?
0
omarfaridCommented:
I think you need to give it a try :)
0
stummjAuthor Commented:
LOL I reckon you are right. Thanks omarfarid, this is a steep learning curve for me. I would usually do this in Oracle not by UNIX text processing!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.