I need to remove run_list values between [] and replace them with a variable I define in a.
RUNLIST:
{
"name": "blah200.blah.stage.blahblah.com",
"chef_environment": "blahenv",
"run_list": [
"recipe[blah1]",
"recipe[blah2]",
"recipe[blah3]",
"recipe[blah4]",
"recipe[blah5]",
"recipe[blah6]",
"recipe[blah7]",
"recipe[blah8]",
"recipe[blah9]"
]
,
"normal": {
"tags": [
"run_once"
],
"selinux": {
"status": "disabled"
},
"blah_pkger": {
"access": {
"blah": "x.x.x.x"
}
}
}
}
a="[ recipe[blah11], recipe[blah12], recipe[blah12], recipe[blah13], recipe[blah14], recipe[blah15], recipe[blah16], recipe[blah17], recipe[blah18], recipe[blah19], recipe[blah20], recipe[blah21], recipe[blah22], recipe[blah23] ]"
I know I can do something like
jq --args newval $a '(.run_list[]| select(.run_list))|= $newval' file.json > tmp.json
but it is failing giving me this error:
jq: error: syntax error, unexpected $end (Unix shell quoting issues?) at <top-level>, line 1: