need help to find & replace a string in file

March 3, 2011 at 01:37:27
Specs: Windows XP
I'm new to scripting, I need help for writing a script to find a particular string & replace it with new string in all files under a folder. Second requirement is to find a signature(key) & change it's value. The files are all text files (infact java sources & some XML)

See More: need help to find & replace a string in file

Report •

March 3, 2011 at 23:34:21
This is the general form to replace a string. But it gets tricky with xml [and maybe java] because of special use chars, like < & >.

:: ==========================================
:: chgstr.bat Fri 04-03-2011 14:29:09.34
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (myfile) do (
set S=%%a
set S=!S:apple=berry!
>> newfile echo.!S!

Life is too important to be taken seriously.


Report •
Related Solutions

Ask Question