I'm trying to modify the deluge
web.conf
file with jq
and I'm having some issues. The deluge web config seems to be invalid json
{
"file": 1,
"format": 1
}
{
"sidebar_show_zero": false,
"show_session_speed": false,
"pwd_sha1": "CHANGEME",
"show_sidebar": true,
"sessions": {},
"enabled_plugins": [],
"base": "/",
"first_login": true,
"theme": "gray",
"pkey": "ssl/daemon.pkey",
"default_daemon": "",
"cert": "test",
"session_timeout": 3600,
"https": false,
"interface": "0.0.0.0",
"sidebar_multiple_filters": true,
"pwd_salt": "salt",
"port": 8112
}
It has multiple top level elements which aren't separated by a comma so if I try to edit the file with jq
using something like this jq '.pwd_sha1 = "NEW HASH"' web.conf
I get the following
{
"file": 1,
"format": 1,
"pwd_sha1": "NEW HASH"
}
{
"sidebar_show_zero": false,
"show_session_speed": false,
"pwd_sha1": "NEW HASH",
"show_sidebar": true,
"sessions": {},
"enabled_plugins": [],
"base": "/",
"first_login": true,
"theme": "gray",
"pkey": "ssl/daemon.pkey",
"default_daemon": "",
"cert": "test",
"session_timeout": 3600,
"https": false,
"interface": "0.0.0.0",
"sidebar_multiple_filters": true,
"pwd_salt": "salt",
"port": 8112
}
jq
is adding a new element to the first top level object and changing the second top level element's value. How can I get this to only change the existing item in the second top level element?