How to find common strings among two very large files?

后端 未结 8 1908
天涯浪人
天涯浪人 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:25

    To do it in windows, its pretty simple .. lets say , you have two files A and B. 'A' files contains the strings you want to search in file B. just open command prompt and use the following command

    FINDSTR /G:A B > OUTPUT
    

    this command is pretty fast and can compare two files very efficiently. The file OUTPUT will contain the strings common in A and B.

    if you want to perform the OR operations (strings in B other than A) then use

    FINDSTR /V /G:A B > OUTPUT
    

提交回复
热议问题