I would like to replace all {} with a specific line with [], but unfortunately I can only match the last occurrence of a regular expression.
I have a configuration file that has the following structure:
entry {
id 123456789
desc This is a description of {foo} and was added by {bar}
trigger 987654321
}
I have the following sed from which you can replace the last bit of "bar", but not "foo":
sed s'/\(desc.*\){\(.*\)}/\1\[\2\]/g' < filename
I bind this search to a string containing "desc", since I would not want it to replace the braces of each "entry" block.
Throughout life, I cannot figure out how to replace all occurrences.
Any help is appreciated - she studied all day and could not read more textbooks, fearing that my corneas might break.
Thank!
source
share