I have two text files which contain the below numbers
File1
00000
11111
File2
00000
11111
22222
I need a code which compares the contents of file2 to that of file1 and the numbers which are not matched , in this case '22222' be the only content in file2.
In short i want to erase the content of file2 and put the non matched content in file2. Below is the code i have tried but it just erases the entire thing in the file2.
setlocal enabledelayedexpansion
for /f "tokens=1" %%a in (file1) do (type file2 | findstr /v %%a > file2)
pause
Bottom line i need to achieve the below results
File1
00000
11111
File2
22222
Help please !