如何使用Shell脚本在JSON中插入字符串并按字母顺序对文件进行排序

时间:2019-03-19 08:58:36

标签: json shell sorting scripting

说我有JSON文件,我必须插入两个新字符串ccddff-live和ccddff-preview,这两个字符串必须通过外壳脚本插入到下面的JSON文件中并按字母顺序排序

插入之前

{`` "bbccdd-live": { "master_url": "http://master.solar.local:8083/solr/bbccdd-live", "poll_interval": "00:01:00" }, }

插入后

"bbccdd-live": { "master_url": "http://master.solar.local:8083/solr/bbccdd-live", "poll_interval": "00:01:00" }, "bbccdd-preview": { "master_url": "http://master.solar.local:8083/solr/bbccdd-preview", "poll_interval": "00:01:00" }, "ccddee-live": { "master_url": "http://master.solar.local:8083/solr/ccddee-live", "poll_interval": "00:01:00" }, "ccddee-preview": { "master_url": "http://master.solar.local:8083/solr/ccddee-preview", "poll_interval": "00:01:00" }

0 个答案:

没有答案