i want to replacea character in a text file using batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ashdepp
Posts: 1
Joined: 25 Jul 2010 23:09

i want to replacea character in a text file using batch file

#1 Post by ashdepp » 25 Jul 2010 23:15

can anyone hepl me out with this ???

:oops:

thanks

Andi
Posts: 5
Joined: 23 Jul 2010 07:46

Re: i want to replacea character in a text file using batch

#2 Post by Andi » 26 Jul 2010 00:15

Hi
you should post what exactly you want to do; at the moment it is too abstract.
You would have to know what exactly you want to replace.

You may want to check out sfk.exe - a free tool which you could download here:
http://stahlworks.com/dev/swiss-file-knife.html

Sincerely
Andi

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

Re: i want to replacea character in a text file using batch

#3 Post by ghostmachine4 » 26 Jul 2010 01:05

download sed for windows then use this syntax

Code: Select all

c:\> sed "s/old word/replacement/g" file


the "g" modifier does a global replacement.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: i want to replacea character in a text file using batch

#4 Post by aGerman » 26 Jul 2010 05:46

Using native batch you have to do that with a FOR loop. If the file contain nonpritable characters it will not work. If the file contain spezial characters like ^<>|& it's possible but difficult.
Tell some more about the file and the character you want to replace.

Regards
aGerman

Post Reply