windows - modify the found text using batch file -


firstly, looking different this:

my purpose modify

"fillcolor="#242838" fillcolor="mycolor"

however, hex color in statement can

"fillcolor="#221231"or "fillcolor="#213123"

so how can find & edit text using windows batch file.

edit: have tried jrepl.bat regular expression find/replace utility tool this.

jrepl "android:fillcolor=(.*?)" "fillcolor="mycolor" /x /f myfile.xml /o -

however, escaping "doesn't work in line.

i have tried "", \", ^" don't me escape " character.

the task can done jrepl.bat example using following command line:

jrepl.bat "(android:fillcolor=\x22#)[0-9a-fa-f]+" "$1ff0000" /f myfile.xml /o - 

explanation of search string:

(...) ... marking group. string found group back-referenced in replace string expression $1.

\x22 ... double quote character specified hexadecimal code value.

[0-9a-fa-f]+ ... find hexadecimal digit 1 or more times.

all other characters in search expression literal interpreted characters find in file.

explanation of replace string:

$1 ... back-reference fixed string found marking group in search regular expression.

ff0000 ... new color value here red (rgb).

it necessary replace task use marking group jrepl.bat using not support look-behind match color value replace in right context.

this command line must called command call when used within batch file:

call jrepl.bat "(android:fillcolor=\x22#)[0-9a-fa-f]+" "$1ff0000" /f myfile.xml /o - 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -