\n new line (find and replace)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
oosrikanth
Posts: 3
Joined: 17 Jun 2012 23:16

\n new line (find and replace)

#1 Post by oosrikanth » 18 Jun 2012 04:18

find one word
after that word give enter


suppose in the sentence the word "excel" get enter excel start from new para

oosrikanth
Posts: 3
Joined: 17 Jun 2012 23:16

Re: \n new line (find and replace)

#2 Post by oosrikanth » 18 Jun 2012 04:27

i need below in the batch file
in ms word
if i want new para

in find and replace
in find "excel"
in replace ^pexcel
it changes to new para

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: \n new line (find and replace)

#3 Post by foxidrive » 18 Jun 2012 08:23

If it is a plain text file you are working with then SED is a good text editing tool.

But if you are using .DOC file from MSword then you are stuck with the built-in VBA scripting.

oosrikanth
Posts: 3
Joined: 17 Jun 2012 23:16

Re: \n new line (find and replace)

#4 Post by oosrikanth » 21 Jun 2012 06:54

cannot do with batch file

for example
changing below code
of internet batchsubstitue.bat

@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
:$changed 20100115
:$source http://www.dostips.com
if "%~1"=="" 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%%" /t
for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
) ELSE echo.
)

Post Reply