need batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jj4u0
Posts: 1
Joined: 20 Mar 2013 13:10

need batch file

#1 Post by jj4u0 » 20 Mar 2013 13:25

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

mfm4aa
Posts: 70
Joined: 13 Feb 2013 14:02
Location: Europe

Re: need batch file

#2 Post by mfm4aa » 20 Mar 2013 16:46

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

Ocalabob
Posts: 79
Joined: 24 Dec 2010 12:16
Location: Micanopy Florida

Re: need batch file

#3 Post by Ocalabob » 20 Mar 2013 22:46

@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:

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!

Post Reply