Computing.Net > Forums > Windows 95/98 > find and replace text in batch mode

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.

find and replace text in batch mode

Reply to Message Icon

Name: pere
Date: March 28, 2006 at 07:22:42 Pacific
OS: windows 98
CPU/Ram: p4 1800
Product: asus
Comment:

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:
1234string1lkjelkjfdsaf

I want to run a batch like this "replace.bat string1 string2" and get this result in "me.txt"
1234string2lkjelkjfdsaf

thanks


pere



Sponsored Link
Ads by Google

Response Number 1
Name: bofra
Date: March 28, 2006 at 18:04:09 Pacific
Reply:

hmmm...
might try programming section:
http://computing.net/programming/wwwboard/wwwboard.html

also a program like:
saerch and replace
http://www.funduc.com/search_replace.htm


0

Response Number 2
Name: Mechanix2Go
Date: March 28, 2006 at 23:08:17 Pacific
Reply:

You'll need a 3rd party utility like:

change


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


0

Response Number 3
Name: pere
Date: March 29, 2006 at 03:09:39 Pacific
Reply:

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


0

Response Number 4
Name: Mechanix2Go
Date: March 29, 2006 at 04:20:46 Pacific
Reply:

This one will do files of any size:

Change9.11



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

M2Go



0

Response Number 5
Name: pere
Date: March 29, 2006 at 06:12:20 Pacific
Reply:

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 Granata

This is the file:
http://perso.wanadoo.es/perepere2/titol.ptl

Don't know why it doesn't work.

Can you help me?
Thanks


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: March 29, 2006 at 11:01:07 Pacific
Reply:

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



0

Response Number 7
Name: pere
Date: March 31, 2006 at 03:09:01 Pacific
Reply:

I sent the file to you mechanix2go, can you help me?
thanks
pere


0

Response Number 8
Name: Mechanix2Go
Date: March 31, 2006 at 03:32:36 Pacific
Reply:

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 n

and 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 r

Do 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


0

Response Number 9
Name: pere
Date: April 1, 2006 at 00:51:47 Pacific
Reply:

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


0

Response Number 10
Name: Mechanix2Go
Date: April 1, 2006 at 01:10:30 Pacific
Reply:

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


0

Response Number 11
Name: James007
Date: April 15, 2006 at 14:22:53 Pacific
Reply:

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?


0

Response Number 12
Name: Mechanix2Go
Date: April 16, 2006 at 01:55:33 Pacific
Reply:

change.com c:\test.txt "beach" "boat"


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

M2


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 Windows 95/98 Forum Home


Sponsored links

Ads by Google


Results for: find and replace text in batch mode

Find and Replace in Word 97 www.computing.net/answers/windows-95/find-and-replace-in-word-97/18198.html

Struckout and underlined text in Word 2000 www.computing.net/answers/windows-95/struckout-and-underlined-text-in-word-2000/48987.html

Unable to start in Safe Mode www.computing.net/answers/windows-95/unable-to-start-in-safe-mode/117790.html