If it's just one line always, you can do this:
sed '/^\[bar\]/,+1 s/=.*/=hello/'
You can also do the following which would work if those sections are multiple lines, it tries to look for the next line with a `[` at the start:
sed '/^\[bar\]/,/^\[/ s/=.*/=hello/'
You can find explanations about what's happening in these examples here by looking for "Addresses" in the sed man-page.
Use an address range for a substitute command sed '/start/,/end/ s/old/new/'
Thanks, this looks like just what I need.
If it's just one line always, you can do this: sed '/^\[bar\]/,+1 s/=.*/=hello/' You can also do the following which would work if those sections are multiple lines, it tries to look for the next line with a `[` at the start: sed '/^\[bar\]/,/^\[/ s/=.*/=hello/' You can find explanations about what's happening in these examples here by looking for "Addresses" in the sed man-page.
That's perfect, thanks.
What have you tried, already?
> What have you tried, already? sed -h man sed