need to do find and replace in a text file ,

May 10, 2009 at 02:54:17
Specs: Windows XP
i need to replace a key word in a text file through cmd script the record length of a record in the file is 2600. i am using below mentioned code for the same

@echo off
REM -- Prepare the Command Processor --

::BatchSubstitude - parses a File line by line and replaces a substring"
::syntax: BatchSubstitude.bat OldStr NewStr File
:: OldStr [in] - string to be replaced
:: NewStr [in] - string to replace with
:: File [in] - file to be parsed
if "%*"=="" findstr "^::" "%~f0"&GOTO:EOF
for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
set "line=%%B"
if defined line (
call set "line=echo.%%line:%~1=%~2%%"
for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
) ELSE echo.

Length of record in my input file is 2600 bytes. but the above utility is only reading 1022 bytes of record and ignoring the rest. Kindly suggest how can i make it to read whole 2600 length record for find and replace.

See More: need to do find and replace in a text file ,

Report •

May 10, 2009 at 04:31:01
There is a forum devoted to Programming accessible from the menu on the right. You may find more help there

The problem with Socialism is that eventually you run out of other people's money!

Report •

May 10, 2009 at 10:11:47
This is probably no help, but I think there is a 1024 character string limit in DOS. Like Ewen suggested, if you don't get any help here, try the programming forum.

Report •

Related Solutions

Ask Question