Yes, I know there’s a plenty of question like this. In fact, I tried some code to replace the line
begin{flushleft}
with %begin{flushleft}
(the same, but commentend and obliterad) taking inspiration from the various questions, but the line remains unchanged
@echo off
set "Find="code1": begin{flushleft}"
set "Replace="code1": %begin{flushleft}"
set "source=merged.tex"
set "target=merged-new.tex"
setlocal enableDelayedExpansion
(
for /F "tokens=1* delims=:" %%a in ('findstr /N "^" %source%') do (
set "line=%%b"
if defined line set "line=!line:%Find%=%Replace%!"
echo(!line!
)
) > %target%
MOVE %target% %source%
endlocal
@PAUSE