Generation

linuxSun, 13 Nov 2022

Get all fields from nmcli and convert to json

nmcli -f all c | jq -R 'split("\n") | map(split(":") | map(if test("^\\s*$") then null else . end)) | map({"(key)": .[0], "(value)": .[1:]|join(":")}) | from_entries'

Questions about programming?Chat with your personal AI assistant