I have a config file that looks like this:
...
[env.staging]
name = "something"
...
[env.production]
name = "something"
...
I'm trying to replace the value of name on a specific environment using regex in the sed command in bash, but when I try to find the line by its section followed by a New Line, it doesn't work:
sed -i -e '/\[env\.production\]\nname =/s/=.*/= \"something_else\"/' config.toml
But the following command works fine, and of course, changes the name variable of both environments which is not desired.
sed -i -e '/name =/s/=.*/= \"something_else\"/' config.toml
Any ideas on how to achieve the correct result? (All my files are using LF line endings)
name = "..."entry always come immediately after the stanza/header? will you only be changing thename = "..."entry or could you need the ability to change other variables, too?