Computing.Net > Forums > Windows XP > need to do find and replace in a text file ,

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.

need to do find and replace in a text file ,

Reply to Message Icon

Name: pawanshuklaitbhu
Date: May 10, 2009 at 02:54:17 Pacific
OS: Windows XP
Subcategory: General
Comment:

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 --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION

::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.



Sponsored Link
Ads by Google

Response Number 1
Name: Ewen
Date: May 10, 2009 at 04:31:01 Pacific
Reply:

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!


0

Response Number 2
Name: aegis1
Date: May 10, 2009 at 10:11:47 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: need to do find and replace in a text file ,

Batch file parsing a text file www.computing.net/answers/windows-xp/batch-file-parsing-a-text-file/174226.html

parsing through a text file using a batch www.computing.net/answers/windows-xp/parsing-through-a-text-file-using-a-batch-/180355.html

Making a text file list of files in www.computing.net/answers/windows-xp/making-a-text-file-list-of-files-in/125178.html