Insert suffix to every line in TXT file
Posted: 11 Jan 2018 15:08
Hello DOS Tips,
We are trying to insert a suffix to the END of EVERY line in a file.
so we are trying to add a quote mark to the end of each line with
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (c:\sandbox\original.txt) do
set /a N+=1
echo ^"%%a^" ^>c:\sandbox\new.txt
c:\sandbox\original.txt
"Jack and Jill went up the hill
"Jill and Jack went up the hill
c:\sandbox\new.txt
"Jack and Jill went up the hill"
"Jill and Jack went up the hill"
...but there is something wrong with the syntax and my brain is melting.
Help please
We are trying to insert a suffix to the END of EVERY line in a file.
so we are trying to add a quote mark to the end of each line with
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (c:\sandbox\original.txt) do
set /a N+=1
echo ^"%%a^" ^>c:\sandbox\new.txt
c:\sandbox\original.txt
"Jack and Jill went up the hill
"Jill and Jack went up the hill
c:\sandbox\new.txt
"Jack and Jill went up the hill"
"Jill and Jack went up the hill"
...but there is something wrong with the syntax and my brain is melting.
Help please