@ECHO OFF
SETLOCAL
:: establish a zero-byte output file
SET "newfile=u:\newfile.txt"
COPY /y nul "%newfile%" 2>NUL >nul
FOR /f "delims=" %%a IN (q33645665.txt) DO (
FINDSTR /x /i /l /c:"%%a" "%newfile%" >NUL
IF ERRORLEVEL 1 >>"%newfile%" ECHO %%a
)
TYPE "%newfile%"
GOTO :EOF
I used a file named q33645665.txt
containing your data for my testing.
Produces u:\newfile.txt
FINDSTR
will set errorlevel
to 0
if a string matching %%a
is found in the new file. /x
forces the match to be on the entire line, /i
specifies that the match be case-insensitive. /l
makes the match literal, not a regular expression and /c:
preceding a string specifies that the string provided is one element, not a set of strings so that a string containing separators liek spaces can be matched.