I have text file: new.txt
a set="true"
b set="true"
c set="true"
d set="true"
and I need to change c set="false" with simple batch file.
please help.
Thanks
need batch file
Moderator: DosItHelp
Re: need batch file
Here we go:
Code: Select all
@echo off &setlocal
(for /f "delims=" %%i in (new.txt) do if "%%i"=="c set="true"" (echo.c set="false") else echo.%%i)>newnew.txt
endlocal
Re: need batch file
@mfm4aa
I tested your lines and they gave the expected results using the OP's
example. Good job!
Just for fun (not meeting jj4u0's request for "simple") here's a quick
SED solution:
Best wishes all!
I tested your lines and they gave the expected results using the OP's
example. Good job!
Just for fun (not meeting jj4u0's request for "simple") here's a quick
SED solution:
Code: Select all
@echo off
SED "s/c set=\"true\"/c set=\"false\"/" new.txt>$tmp$.bob
move $tmp$.bob new.txt>nul
Best wishes all!