I'm trying to remove duplicate lines from a file,
I found this code made by !k
Code: Select all
for /f "tokens=2 delims=/" %%a in ('sort infile.txt') do (
findstr /ixc:"%%a" exclude.txt only_new.txt ||echo,%%a>> only_new.txt
)
But i don't understand it, what exclude.txt and only_new.txt do
my file is like this
test1
test2
test1
test3
test2
test1
test3
the output should be like this
test1
test2
test3
The code work fine after changing the tokens to * and removing the delims, but it generate errors becdasue the two files not exist.
can any one explain it,
thanks