How to find common strings among two very large files?

后端 未结 8 1907
天涯浪人
天涯浪人 2021-02-06 07:08

I have two very large files (and neither of them would fit in memory). Each file has one string (which doesn\'t have spaces in

8条回答
  •  天涯浪人
    2021-02-06 07:43

    You haven't said what platform you're working on, so I assume you're working on Windows, but in the unlikely event that you're on a Unix platform, standard tools will do it for you.

    sort file1 | uniq > output
    sort file2 | uniq >> output
    sort file3 | uniq >> output
    ...
    sort output | uniq -d
    

提交回复
热议问题