substitution - substituting a string with cmd with wildchar -


i have text file me contains lines

line1 line2 helloabcd line4 

i want create batch file edit helloabcd line %this% dont know abcd know hello. how can it?

i tried using fart.exe, never substituted when there wildcard

fart.exe txt1.txt hello* %this% 

can done using pure cmd, or fart?

thanks in advance reply

edit: ok tried fart.exe txt1.txt hello %this% got %this%abcd instead of %this%

try this:

@echo off &setlocal set "this=wqreqwrq" /f "delims=" %%i in ('^<txt1.txt findstr /n "^"') (     set "line=%%i"     setlocal enabledelayedexpansion     set "line=!line:*:=!"     if not "!line!"=="!line:hello=!" set "line=%this%"     (echo(!line!)>>output.txt     endlocal ) 

output in output.txt.

edit: add. "!" removed.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -