Article 5PGWQ [SOLVED] Regex - Modify Parameter in config file

[SOLVED] Regex - Modify Parameter in config file

by
angel115
from LinuxQuestions.org on (#5PGWQ)
Hi There,

I'd like to modify a parameter in a config file using a regex
Sample config file:
Code:[ServiceXY]
ParamXY=true
Enable=False

[Service123]
ParamXY=true
Enable=False

[Service345]
ParamXY=true
Enable=False

[Service456]
ParamXY=true
Enable=FalseMy goal is to modify the "Enable=False" of the section "Service345" to "Enable=True"

The following work fine in Regex101.com
Match
Code:/(\[Service345\]\r?\n.*(\r?\n([^[\r\n].*)?)*Enable=)False/And use this as substitution
Code:/$1True/
But when I try to use it in command line it doesn't work:
Code:perl -pe 's/(\[Service345\]\r?\n.*(\r?\n([^[\r\n].*)?)*Enable=)False/\1/gm' test.confAny Idea why it doesn't substitute in command line?

Thanks for your help.latest?d=yIl2AUoC8zA latest?i=96iHgIcVbzQ:G2wp_4P07MA:F7zBnMy latest?i=96iHgIcVbzQ:G2wp_4P07MA:V_sGLiP latest?d=qj6IDK7rITs latest?i=96iHgIcVbzQ:G2wp_4P07MA:gIN9vFw96iHgIcVbzQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments