I have a JSON file which contain multiple occurrence of replaceme
.
I only want to substitute an occurrence based on a specific string found a few line above.
E.g.,
[...]
"title" : {
"Propertie1" : "xxxx",
"Propertie2: "replaceme"
}
"title2" : {
"Propertie1" : "xxxx",
"Propertie2: "replaceme"
}
"title" : {
"Propertie1" : "xxxx",
"Propertie2: "replaceme"
}
"title2" : {
"Propertie1" : "xxxx",
"Propertie2: "replaceme"
}
[...]
In this example, I want to substitute replaceme
only for title2
.
With awk 'title2/,/replaceme/' myFile
I am able to locate the part of my JSON file. Do I need to execute a sed command too, but I don't know how, or if it's even possible that way?