4 added 211 characters in body
source | link

I am posting this question because I am unable to add a comment to an answer submitted by Kusalananda here: "key = value" lines: how to replace a specific key's value?

He proposed the following solution:

sed -E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFile

Q1: What is the meaning of "\1"?

Q2: How can I modify this when dealing with key-value pairs with quotations around the value? e.g.

MTU="1500"

--- edit ---

Q3: In trying the suggestion from RalfFriedl I discovered that the name of my variable is being inserted, not the value.

sed -E 's/^(MTU[[:blank:]]*=[[:blank:]]*).*/\1$NewMtu/' MyEthFile

I am posting this question because I am unable to add a comment to an answer submitted by Kusalananda here: "key = value" lines: how to replace a specific key's value?

He proposed the following solution:

sed -E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFile

Q1: What is the meaning of "\1"?

Q2: How can I modify this when dealing with key-value pairs with quotations around the value? e.g.

MTU="1500"

I am posting this question because I am unable to add a comment to an answer submitted by Kusalananda here: "key = value" lines: how to replace a specific key's value?

He proposed the following solution:

sed -E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFile

Q1: What is the meaning of "\1"?

Q2: How can I modify this when dealing with key-value pairs with quotations around the value? e.g.

MTU="1500"

--- edit ---

Q3: In trying the suggestion from RalfFriedl I discovered that the name of my variable is being inserted, not the value.

sed -E 's/^(MTU[[:blank:]]*=[[:blank:]]*).*/\1$NewMtu/' MyEthFile
    Post Closed as "duplicate" by don_crissti, JdeBP, Thomas Dickey, Kusalananda sed of
3 remove unnecessary "thank you" at the end of the question!
source | link

I am posting this question because I am unable to add a comment to an answer submitted by Kusalananda here: "key = value" lines: how to replace a specific key's value?

He proposed the following solution:

sed -E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFile

Q1: What is the meaning of "\1"?

Q2: How docan I modify this ifwhen dealing with key-value pairs with quotations around the value? e.g.

MTU="1500"

Thanks.

I am posting this question because I am unable to add a comment to an answer submitted by Kusalananda here: "key = value" lines: how to replace a specific key's value?

He proposed the following solution:

sed -E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFile

Q1: What is the meaning of "\1"?

Q2: How do I modify this if dealing with key-value pairs with quotations around the value? e.g.

MTU="1500"

Thanks.

I am posting this question because I am unable to add a comment to an answer submitted by Kusalananda here: "key = value" lines: how to replace a specific key's value?

He proposed the following solution:

sed -E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFile

Q1: What is the meaning of "\1"?

Q2: How can I modify this when dealing with key-value pairs with quotations around the value? e.g.

MTU="1500"
2 edited tags; edited title
| link

What is the meaning of '\1' in sed the right-E 's/^(power[[:blank:]]*=[[:blank:]]*).*/\1something/' TheFilehand side of a sed substitution?

1
source | link