I have a file.txt where there are lines as
IF TANK T395 LEVEL ABOVE 4 THEN PUMP PFALDA395&T395 STATUS IS CLOSED
that I would like to transform in
IF TANK T395 LEVEL ABOVE 4
THEN PUMP PFALDA395&T395 STATUS IS CLOSED
I tried with this code.bat
@echo off
del "newfile.txt" 2>nul
(
for /f "eol=| usebackq for /f tokens=1,2,3,4,5,6,* delims= " %%a %%b %%c %%d %%e %%f %%g in ("oldfile.txt") do (
for /f %%h in ("%%g") do (
if /i "%%h"=="THEN" (
echo %%a %%b %%c %%d %%e %%f
echo. %%g
)
)
echo %%a %%b %%c %%d %%e %%f %%g
)
)>"newfile.txt"
I got a fast
%b non atteso (not waited)
What am I stumbling in?