I have the first text file, example:

amet
sint
perspiciatis
minima

And I have the second file full of text, example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

I want the output to be:

perspiciatis
minima

I tried using findstr /G:1.txt 2.txt >> C:\Temp\results.txt But this prints lines from the second file that contain the line from the first one, but I want the lines from the first file that don't exists in the second file.

1

There are 1 best solutions below

2
Peca21 On

OFC I found the answer after I posted a question

@echo off
setlocal enabledelayedexpansion
for /F "tokens=*" %%A in (1.txt) do (
    findstr %%A 2.txt > nul || echo %%A
)
pause