Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • The goal that I am going for is for the final product to look like this: setting1 value1new setting2 = value2new setting3 = value3new setting4 = value4new Commented May 11, 2017 at 19:57
  • 1
    Really the whole idea of regular expressions is to avoid matching every variant pattern case-by-case: for example, you could match zero or more spaces followed by an optional equals sign "s/^${var} *=\{0,1\}.*/${var} = ${new_value}/" Commented May 11, 2017 at 20:10
  • What was the last portion meant to do anyway? Commented May 11, 2017 at 20:43
  • @Philippos is that portion question directed at me or @steeldriver? Commented May 11, 2017 at 20:47
  • @steeldriver I fully agree. I'm no expert at scripting though I never intended to create a case-by-case match, I just didn't know how to do a "catch all" statement. Thanks! :) Commented May 11, 2017 at 20:48