I would like to filter DNSNames where Id does not start with the DNSName.
Given the following JSON:
[ {"Id": "9580cf2dd3161c0e33d8c04a4e84384e28784af65e55c1e84899d9da797902be","NetworkSettings": {"Networks": {"nextcloud-aio": {"IPAddress": "172.18.0.10","DNSNames": ["nextcloud-aio-whiteboard","9580cf2dd316" ] } } } }]if I execute the following query:
jq -r '.[]|"\(.NetworkSettings.Networks[].IPAddress|select(length > 0) // "# no ip address:") \(if .NetworkSettings.Networks[].DNSNames != null then (.NetworkSettings.Networks[].DNSNames|join(" ")) else (.Name|sub("^/"; "")|sub("_1$"; "")) end)"'I get the following result:
172.18.0.10 nextcloud-aio-whiteboard 9580cf2dd316How can I filter out 9580cf2dd316 based in the Id9580cf2dd3161c0e33d8c04a4e84384e28784af65e55c1e84899d9da797902be so I get the following result?
172.18.0.10 nextcloud-aio-whiteboard