@ECHO OFF
:: version 1 - "replace regardless"
SETLOCAL ENABLEDELAYEDEXPANSION
(
FOR /f "delims=" %%a IN (q26733113.txt) DO (
SET "line=%%a"
ECHO(!line:~0,13!A!line:~14!
)
)>newfile.txt
:: version2 - "replace only if space found in position"
SETLOCAL ENABLEDELAYEDEXPANSION
(
FOR /f "delims=" %%a IN (q26733113.txt) DO (
SET "line=%%a"
IF "!line:~13,1!"==" " (ECHO(!line:~0,13!A!line:~14!) ELSE (ECHO(%%a)
)
)>newfile2.txt
GOTO :EOF
I used a file named q26733113.txt
containing your data for my testing.
Produces newfile.txt
and newfile2.txt
- the first changing column - well 14 in normal counting, as indicated in your test data - regardless of the content of column 14. The second only replaces column 14 with the A
if it was a space, otherwise leaves it as-is.
Don't worry about the seeming-unbalanced parentheses. echo(
has special properties - te parenthesis isn't counted...