Computing.Net > Forums > Programming > Editing a Text File With a Batch

Editing a Text File With a Batch

Reply to Message Icon

Original Message
Name: Observer8686
Date: November 18, 2006 at 17:20:51 Pacific
Subject: Editing a Text File With a Batch
OS: Windows XP SP2
CPU/Ram: AMD Athlon 64 +3200 2GB
Model/Manufacturer: N/A
Comment:

I need a batch file that changes the following .txt file located in “C:\Program Files\Adobe\temp\a001day\cram32\index.txt” the batch file will be placed in “C:\Program Files\Adobe”.

The index file looks like this.

“alpha 0098-%da.BMP
ETXT 69 64 16 {0 0 0 0}
EAGL64%20metal%20bin%20attachment%20for%20runtime%20texture%20management%00%00%00%00%00%00
ETXT 70 glow%00%00%00%00%00%00%00%00
bplt 0099-%d.BMP
MBP+2 60 x2 64 64 {0 0 0}
ETXT 69 64 16 {0 0 0 0}
EAGL64%20metal%20bin%20attachment%20for%20runtime%20texture%20management%00%00%00%00%00%00
ETXT 70 bplt%00%00%00%00%00%00%00%00
deck 0100-%d.BMP
MBP+2 61 x2 64 64 {0 0 0}
alpha 0100-%da.BMP
ETXT 69 64 16 {0 0 0 0}
EAGL64%20metal%20bin%20attachment%20for%20runtime%20texture%20management%00%00%00%00%00%00
ETXT 70 deck%00%00%00%00%00%00%00%00”

I need to change the
“bplt 0099-%d.BMP
MBP+2 60 x2 64 64 {0 0 0}
ETXT 69 64 16 {0 0 0 0}”

To
“bplt 0099-%d.BMP
MBP+2 60 x2 512 256 {0 0 0}
ETXT 69 64 16 {0 0 0 0}”

Basically I just need to change “64 64” in the seventh line to “512 256”

If someone could show me how to do this with a batch file I would be internally grateful.


Report Offensive Message For Removal


Response Number 1
Name: Observer8686
Date: November 18, 2006 at 18:38:25 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

I figured out by using Change.com and this script
change temp\a001day\cram32\index.txt "MBP+2 60 x2 64 64 {0 0 0}" "MBP+2 60 x2 512 256 {0 0 0}"

it changed it to what I wanted. The only problem is there are other segments that are identical to this line that I don't want changed . Anyone know how to make it only change this one line?


Report Offensive Follow Up For Removal

Response Number 2
Name: Observer8686
Date: November 18, 2006 at 19:26:33 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

I figured it out.
change temp\a001day\cram32\index.txt "64 64" "512 256" /LINES line574


Report Offensive Follow Up For Removal

Response Number 3
Name: Observer8686
Date: November 18, 2006 at 19:51:07 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

I thought that had worked but apparently it didn't. Does anyone know how to make it only change line 574?


Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: November 18, 2006 at 23:02:05 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

@echo off
setLocal EnableDelayedExpansion

for /f %%L in (myfile) do (
set /a NUM+=1
if !NUM! equ 7 echo this is line !NUM! so do the change
)



=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 5
Name: Observer8686
Date: November 19, 2006 at 05:23:27 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

I have to go to a meeting right now but when I get back first thing I’m doing is giving this a try.
Thanks for your help, I really appreciate it.


Report Offensive Follow Up For Removal


Response Number 6
Name: Observer8686
Date: November 19, 2006 at 10:15:08 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

I think you lost me a little bit.
What exactly would the batch file look like to change line 574 in the above mentioned text file?
from
MBP+2 61 x2 64 64 {0 0 0}
to
MBP+2 61 x2 512 256 {0 0 0}

I apologize for my stupidity here but I could really use some more help.
I really appreciate you trying, thanks.


Report Offensive Follow Up For Removal

Response Number 7
Name: Observer8686
Date: November 19, 2006 at 14:39:54 Pacific
Subject: Editing a Text File With a Batch
Reply: (edit)

Alright I found out what I was doing wrong.
This one works.
CHANGE /LINES 574-574 temp\a001day\cram32\index.fsh /FROM "64 64" /TO "512 256"
Thanks for your help Mechanix2Go.


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Editing a Text File With a Batch

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge