add string in between the file using DOS

December 15, 2010 at 03:46:56
Specs: Windows XP
I need to find a string in a file and replace the same string with different value.

for eg:
filename: test.txt
content: Name: Ramesh
Company: ACE
Residence: India

I need to replace "ACE" with lets say "ABC"

Final result should be:
Name: Ramesh
Company: ABC
Residence: India

Please help me find the solution to this situation.

Thanks in advance


See More: add string in between the file using DOS

Report •

#1
December 15, 2010 at 04:08:33
In DOS, not much hope. In XP:

===========================================
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (test.txt) do (
set S=%%a
set S=!S:ACE=ABC!
>> newfile echo.!S!
)


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
December 15, 2010 at 04:57:00
Thank it's works

Report •
Related Solutions


Ask Question