I am new to DOS programming.
I have the following text file:
PT(1,004)= 75.0D0, -2.70D0,
What i want to do is edit the portion of the text -2.70D0, to other values like -2.75D0, -2.80D0 and so on. (There are 8 spaces in front of the PT(1,004) and they have to be kept intact too).
From the previous post
I tried out the code:
@echo off > newfile
for /f "tokens=* delims=@" %%a in (input.txt) do (
if "%%a"==" PT(1,004)= 75.0D0, -2.70D0," (
echo: PT(1,004)= 75.0D0, -2.75D0,>> newfile
) else (
echo %%a >> newfile
I used the delimiter @ as it is non-existent in the text file. When I execute the code, there are 2 problems:
1. Error message saying "Incorrect usage of 75.0D0".
2. Blank lines are removed in the newfile.
Please advise on the error message and how can I keep the blank lines when output to newfile. (Many posts in this forum are about removing blank lines).
I am using windows XP Japanese version.
As a side question, what is the representation of the CR or LF in DOS program?
Thanks in advance for your advice and help.