Hi all,
Long time no see
I'd like to insert a string into position 15 in a oneliner .txt file using a batch script that utilizes Dave Benham's amazingly great repl.bat (
https://www.dostips.com/forum/viewtopic.php?f=3&t=3855).
I have used repl.bat for years and it is just awesome. Many thanks to Dave if you ever read this!
Here's my batch script
set value=add_this_string
type "file.txt"|repl.bat "(.{14})...............(.*)" "$1%value%$2" > "file.txt.new"
ProblemThe above script works fine if there are already characters in position 15. It also works if position 15 and onwards consist of whitespace. However, if the line ends before pos 15 the string is not inserted.
I discovered repl.bat's successor jrepl.bat (
https://www.dostips.com/forum/viewtopic.php?f=3&t=6044) just the other day but haven't found someone who has solved this problem so any help using either one of them would be of great help!
Any help would be appreciated!