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 ,
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.
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.
Summary: I currently have a batch file with the following lines at or near the beginning: SET TargetIP=www.somesite.com SET PingCount=10 Rather than have the user modify my batch file, I'd like to have the val...
Summary: I had some great help yesterday with another issue and thought I would try this one. I need to replace 12 characters in a text file with a different string of 12 characters. How could I do this in a b...