I have the following json;
[
{
"compartment-id": "CompartmentID-123",
"defined-tags": {},
"display-name": "Test-123",
"freeform-tags": {},
"id": "ID-ABC",
"kms-key-id": "",
"lifecycle-state": "ACTIVE",
}
]
I am looking to join the id
and display-name
params into a comma seperate string with "
and []
stripped, like so:
ID-ABC,Test-123
Closest I've managed to get so far is:
oci fs file-system list -c $compart --availability-domain $ad --query 'data[].[id,"display-name"][]' | tr -d '" '
[
ID-ABC,
Test-123
]
Wondering if there's a cleaner way of doing this all within JMESPath without piping output to tr
, jq
, sed
or awk
etc etc
UPDATE based on input from β.εηοιτ.βε
So close...
oci fs file-system list -c $compart --availability-domain $ad3 --query 'data[0].join(',', [id, "display-name"])'
Returns
ParseError: invalid token: Parse error at column 13, token "," (COMMA), for expression:
"data[0].join(,, [id, "display-name"])"
However playing around with quotes, best I can get is by using;
oci fs file-system list -c $compart --availability-domain $ad3 --query "data[0].join(',', [id, 'display-name'])"
Private key passphrase:
"ID-ABC,display-name"
I'm beginning to wonder if there's something wrong with my local settings or shell, whereby it's getting confused by the quotes marks?