"protocols": {
"name" : "my",
"schemes": [
"demo",
"electron"
]
},
This is my json, i want to edit protocols section where "my" with "my-protocol" and "demo" with "test"
CodePudding user response:
sed -i '/name/c\ \"name\" : \"my-protocol\",' package.json
please try this
CodePudding user response:
This might work for you (GNU sed):
sed '/^"protocols": {/{:a;N;/\n\s*},$/!ba;s/"my"/"my-protocol"/;s/"demo"/"test"/}' file
Match "protocols": {
at the beginning of a line and gather up further lines until one matching },
.
Replace "my"
by "my-protocol"
and "demo"
by "test"
.