Batch file copy a specific line from conf file to another conf file -


using batch file.

in between <username>dynamic_username</username> tag of text1.conf dynamic username string. want automatically selected , copy other file text2.conf , replace blank tag <username>insert here username</username>

text1.conf contains <username>dynamic_username</username> <- on line 19

text2.conf contains <username></username> <- on line 10

thanks in advance

try this:

for /f "tokens=2delims=<>" %%i in ('findstr /i "username" "text1.conf"') set "string=%%i" (for /f "delims=" %%i in ('findstr /n "^" "text2.conf"') (     set "line=%%i"     setlocal enabledelayedexpansion     set "line=!line:*:=!"     if "!line!" neq "!line:username=!" set "line=%string%"     echo(!line!     endlocal ))>"text2.conf.new" 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -