Thanks for the quick advice on the solution.
I am facing another problem.
I have the following code
for /f "tokens=* delims=" %%a in ('findstr "MATY(003)" input.txt') do (
for /f "skip=2 tokens=1* delims=]" %%a in ('find /v /n "" input.txt') do (
if "%%b"==!str! echo.SUCCESS
The input.txt file has the following content
end of file
When the batch file is executed, I don't get the SUCCESS echo. I am puzzled why %%b in the 2nd FOR statement is not matching the !str! set in the 1st FOR statement. Is it because of some hidden characters? Please help.