aceminer
aceminer

Reputation: 4295

Finding if a set of lines exists in a large text file

How do i find out the intersection of 2 files in windows?

TextFile A: 100GB TextFile B: 10MB

All i can think of is using python

I would read the lines in textfile B into memory in python and compare with each line in text file A.

I was wondering if there is any way to do it via the command prompt in linux/windows.

Upvotes: 1

Views: 43

Answers (1)

Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26681

If repetition doesn't matter, then this command will do it:

sort <(sort file1 | uniq) <(sort file2 | uniq) | uniq -d

Upvotes: 1

Related Questions