Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need a method to find and replace text within a text file.
I have a file named, "me.txt" containing a string and I want to change this string by another string.
Example:me.txt content:
1234string1lkjelkjfdsafI want to run a batch like this "replace.bat string1 string2" and get this result in "me.txt"
1234string2lkjelkjfdsafthanks
pere

hmmm...
might try programming section:
http://computing.net/programming/wwwboard/wwwboard.htmlalso a program like:
saerch and replace
http://www.funduc.com/search_replace.htm

You'll need a 3rd party utility like:
It will work for files up to about 32KB. If your files are bigger, post back.
If at first you don't succeed, you're about average.M2

yes, the change app is what I need.
But I need it for larger files.
Is there a change app for files greater than 32K ?thanks
pere

This one will do files of any size:
=====================================
If at first you don't succeed, you're about average.M2Go

Looks like it does not work. With tiny files works but with an XML one, it doesn't.
I try to execute this and don't get any result:
change.exe titol.ptl /from Granada /to GranataThis is the file:
http://perso.wanadoo.es/perepere2/titol.ptlDon't know why it doesn't work.
Can you help me?
Thanks

The Thai government has that site blocked, for whatever stupidass reason.
ZIP it up and send it to me.
BUT
Change the extension to ZI
=====================================
If at first you don't succeed, you're about average.M2Go

Hi pere,
I got it and then got busy.
I don't understand what I'm seeing in the file.
It looks like an XML which somehow has gotten interspersed with 00hex bytes.
Here's a chunk off the top:
■< ? x m l v e r s i o n = " 1 . 0
S h a d e r R e f e r e n c e > 4 0 9
s e < / b o x C a n G r o w > < w o r
< / s i z e > < t x H e i g h t > 3 8
y > < / T y p e S p e c > < / T e x t
> < f i f o n t S t y l e > M e d i u
> t r u e < / E m b e l l i s h m e nand a hex view:
FF FE 3C 00 3F 00 78 00 6D 00 6C 00 20 00 76 00 ■< ? x m l v
65 00 72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 e r s i o n = "
31 00 2E 00 30 00 22 00 20 00 65 00 6E 00 63 00 1 . 0 " e n c
6F 00 64 00 69 00 6E 00 67 00 3D 00 22 00 55 00 o d i n g = " U
54 00 46 00 2D 00 31 00 36 00 22 00 20 00 3F 00 T F - 1 6 " ?
3E 00 3C 00 41 00 64 00 6F 00 62 00 65 00 5F 00 > < A d o b e _
52 00 6F 00 6F 00 74 00 3E 00 3C 00 41 00 64 00 R o o t > < A d
6F 00 62 00 65 00 5F 00 54 00 69 00 74 00 6C 00 o b e _ T i t l
65 00 3E 00 3C 00 56 00 65 00 72 00 73 00 69 00 e > < V e r s i
6F 00 6E 00 3E 00 32 00 30 00 30 00 34 00 30 00 o n > 2 0 0 4 0
34 00 32 00 32 00 3C 00 2F 00 56 00 65 00 72 00 4 2 2 < / V e rDo you know why it is laid out like it is?
Gotta go out the door now to go teach. I'll check in tomorrow.
If at first you don't succeed, you're about average.M2

I really don't know. This file is made by third party software and don't realize the way it does it. May be it's a bad file to make change.exe work.
Pere

The change.exe will work on any file, text or binary, of any size.
If you tried to do that string change with the
/from /to
it probably did not work because the string, instead of being, for instance:
ABCD
would look like:
A B C D
with the "spaces" being not spaces at all but 00hex bytes.
If that's the case, you'll need to write a definition [I think that's what it's called.] file.
Read the CHANGE9.11 docs.
If at first you don't succeed, you're about average.M2

Just a little question...
let's suppose I have a text file called test.txt located at c:\test.txt. In this text file there is a word "beach" but that word should be replaced by "boat".What is the correct syntax to do this?

![]() |
![]() |
![]() |

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