"cassandra": {
"host": "1.1.1.1",
"portNo": "9042",
"keyspace": "good"
},
"postgres": {
"host": "2.2.2.2",
"portNo": "5432",
"database": "dude",
"username": "root",
"password": "something"
}
This is a part of the json file. I need to edit the hosts part with two different IPs using a script. Anyone have any idea
For proper json (your data above surrounded by {}) using jq:
$ jq '.|.cassandra.host="foo"' file.json
{
"cassandra": {
"host": "foo",
"portNo": "9042",
"keyspace": "good"
},
"postgres": {
"host": "2.2.2.2",
"portNo": "5432",
"database": "dude",
"username": "root",
"password": "something"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With