Batch for insert/replace in a txt file in a fixed position

I need to replace, using a Batch file (.bat), a blank character, placed always in a fixed position (column 13) of each line in a .txt file, with another fixed character. What kind of function can I use?

Example of my file:

1000588141025 00LEOTOURING SRL   VIA FILADELFO CASTRO,1         LENTINI 

I'd like to have:

1000588141025A00LEOTOURING SRL   VIA FILADELFO CASTRO,1         LENTINI 


ANSWERS:


@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...


Using REPL.BAT:

type "file.txt"|repl "^(.{12}) " "$1A" >"file.txt.new"
move /y "file.txt.new" "file.txt" >nul


 MORE:


 ? Batch Script - Find and replace text in multiple files in a directory
 ? Find and replace line starts with specific value in text file via windows batch file
 ? Remove folders from txt file in windows cmd
 ? replacing line in txt file AFTER specific line
 ? How to concatenate 2 .csv files in 1 .csv file with multiple sheets using Batch commands
 ? How to remove strings from a text file using batch script?
 ? How to remove strings from a text file using batch script?
 ? How to remove strings from a text file using batch script?
 ? How do I check that a parameter is defined when calling a batch file?
 ? Batch To Remove Character From A String