skip to Main Content

jq convert to csv with keys to column rows – CentOS

I have JSON example like this { "server1": { "dhcp-libs": "12:4.2.5-83.el7.centos.1", "perl-Time-Local": "1.2300-2.el7", "kbd-legacy": "1.15.5-15.el7", "perl-Scalar-List-Utils": "1.27-248.el7", "ncurses-base": "5.9-14.20130511.el7_4", "firewalld": "0.6.3-13.el7_9", "perl-threads": "1.87-4.el7", "aic94xx-firmware": "30-6.el7", "kpartx": "0.4.9-135.el7_9", "perl-Getopt-Long": "2.40-3.el7", "basesystem": "10.0-7.el7.centos", "rsyslog": "8.24.0-57.el7_9.1", "libtirpc": "0.2.4-0.16.el7", "python3-libs": "3.6.8-18.el7", "btrfs-progs": "4.9.1-1.el7", "ncurses-libs":…

VIEW QUESTION

Jq index() Not Found – CentOS

Executing the following jq command works fine on Mac OS Catalina (jq version 1.6) : echo $(jq '.paths | to_entries | map(select(.value[].tags | index("Tag123"))) | from_entries' custom.json) However executing it on CentOS (CentOS release 6.9 (Final)) (jq version 1.3) returns…

VIEW QUESTION

jq – How to extract domains and remove duplicates – Debian

Given the following json: Full file here: https://pastebin.com/Hzt9bq2a { "name": "Visma Public", "domains": [ "accountsettings.connect.identity.stagaws.visma.com", "admin.stage.vismaonline.com", "api.home.stag.visma.com", "api.workbox.dk", "app.workbox.dk", "app.workbox.co.uk", "authz.workbox.dk", "connect.identity.stagaws.visma.com", "eaccounting.stage.vismaonline.com", "eaccountingprinting.stage.vismaonline.com", "http://myservices-api.stage.vismaonline.com/", "identity.stage.vismaonline.com", "myservices.stage.vismaonline.com" ] } How can I transform the data to the below. Which is,…

VIEW QUESTION

I need a reliable method to count the nbr of Resources – CentOS

I have the following JSON that comes back from an API: { "Statement": [{ "Sid": "Group1", "Resource": "arn:aws:ecs:*:777744445555:task-rendition/${aws:PrincipalTag/Service}-*:*", "Effect": "Allow" }, { "Sid": "Group2", "Resource": [ "arn:aws:ecs:*:777744445555:task-definition/${aws:PrincipalTag/Service}-*:*", "arn:aws:ecs:*:777744445555:task-petition/${aws:PrincipalTag/Service}-*:*", "arn:aws:ecs:*:777744445555:task-fruition/${aws:PrincipalTag/Service}-*:*" ], "Effect": "Allow" } ]} When I apply these commands I…

VIEW QUESTION
Back To Top
Search