Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding intersection between two text files in windows cmd

Is there any command on windows to find intersection between two text files?

Example:

File1.txt    File2.txt    
Apple        Pie    
Banana       Apple    
Pie

Output:

Pie    
Apple
like image 256
Green goblin Avatar asked May 27 '26 13:05

Green goblin


1 Answers

findstr /i /L /x /g:"File1.txt" "file2.txt"

should accomplish that quite nicely.

It finds all strings in file2 that /x exactly match /L literally /i but ignoring case /g:file strings in this file.

like image 130
Magoo Avatar answered May 30 '26 02:05

Magoo