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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Editing a Text File With a Batch

Reply to Message Icon

Name: Observer8686
Date: November 18, 2006 at 17:20:51 Pacific
OS: Windows XP SP2
CPU/Ram: AMD Athlon 64 +3200 2GB
Product: 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.



Sponsored Link
Ads by Google

Response Number 1
Name: Observer8686
Date: November 18, 2006 at 18:38:25 Pacific
Reply:

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?


0

Response Number 2
Name: Observer8686
Date: November 18, 2006 at 19:26:33 Pacific
Reply:

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


0

Response Number 3
Name: Observer8686
Date: November 18, 2006 at 19:51:07 Pacific
Reply:

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


0

Response Number 4
Name: Mechanix2Go
Date: November 18, 2006 at 23:02:05 Pacific
Reply:

@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



0

Response Number 5
Name: Observer8686
Date: November 19, 2006 at 05:23:27 Pacific
Reply:

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.


0

Related Posts

See More



Response Number 6
Name: Observer8686
Date: November 19, 2006 at 10:15:08 Pacific
Reply:

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.


0

Response Number 7
Name: Observer8686
Date: November 19, 2006 at 14:39:54 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Editing a Text File With a Batch

Batch search multiple lines in text file. www.computing.net/answers/programming/batch-search-multiple-lines-in-text-file/18768.html

editing text file with batch file www.computing.net/answers/programming/editing-text-file-with-batch-file/15231.html

Editing a txt file with batch files www.computing.net/answers/programming/editing-a-txt-file-with-batch-files/19270.html