Change doubled quoted text to add further items with double quotes

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Skyborg
Posts: 1
Joined: 11 May 2016 05:02

Change doubled quoted text to add further items with double quotes

#1 Post by Skyborg » 11 May 2016 06:09

I do have a problem with special char double quote to search for and replace with.

I do have a text file with content:
attribute1="X" attribute3="X"

which should be replaced by:
attribute1="X" attribute2="X" attribute3="X".

How is this to be accomblished? I really didn't get it. :cry:

Could someone help me out here?

I tried it that way:

Code: Select all

Jrepl.bat "(attribute1=\qX\q attribute3=\qX\q)" "attribute1=\qX\q attribute2=\qX\q attribute3=\qX\q" /M /X /I /F %basepath%%1 /O %basepath%%1_CORRECT

Best regards and many thanks for help.

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

Re: Change doubled quoted text to add further items with double quotes

#2 Post by foxidrive » 11 May 2016 10:10

It is difficult to be exact when your terms are not exact, but try this.

Code: Select all

call jrepl.bat "(attribute1=\q.*?\q).*?(attribute3=\q.*?\q)" "$1 attribute2=\qX\q $2" /X /I /F %basepath%%1 /O %basepath%%1_CORRECT

Post Reply