Script to edit multiple files
Solved/Closed
Freondude
Posts
1
Registration date
Wednesday March 11, 2009
Status
Member
Last seen
March 12, 2009
-
Mar 12, 2009 at 04:23 PM
New2This - Oct 29, 2010 at 03:51 AM
New2This - Oct 29, 2010 at 03:51 AM
Related:
- Windows replace text in multiple files
- Batch script to find and replace text in a file - Best answers
- Batch file replace line in text file - Best answers
- Kmspico windows 10 - Download - Other
- Windows 10 iso file download 64-bit - Download - Windows
- Gta 5 download apk pc windows 10 - Download - Action and adventure
- Clear recent files windows 11 - Guide
- How to delete multiple files on mac - Guide
6 responses
syeddilawer
Posts
1
Registration date
Friday July 31, 2009
Status
Member
Last seen
August 1, 2009
5
Aug 1, 2009 at 12:11 AM
Aug 1, 2009 at 12:11 AM
Hi Freondude,
If you are still looking for an answer, then try this:
1.Open Notepad, Copy and paste the below script :
@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.
)
2. Save the file as “xyz.bat”
The above script will parses a file line by line and will replaces a desired substring.
3. Open cmd prompt >> type the following command:
c:\xyz.bat “text-to-replace” text-to-replace-with c:\FileToEdit.txt > c:\Edited_file.txt
For more info, visit https://winitpro.wordpress.com/2009/07/31/batchscript/
Hope this helps :)
If you are still looking for an answer, then try this:
1.Open Notepad, Copy and paste the below script :
@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.
)
2. Save the file as “xyz.bat”
The above script will parses a file line by line and will replaces a desired substring.
3. Open cmd prompt >> type the following command:
c:\xyz.bat “text-to-replace” text-to-replace-with c:\FileToEdit.txt > c:\Edited_file.txt
For more info, visit https://winitpro.wordpress.com/2009/07/31/batchscript/
Hope this helps :)