I have the following bash command
something something ... |
xargs -L 1 az aks list --subscription |
jq -r '.[] | "az aks get-credentials --name \(.name) --resource-group \(.resourceGroup) --subscription=\(.id)"'
This works except the final argument \(.id) is a string I need to substring using the following commands output embedded in the final output string
awk -F "/" '{print $3}' <<< "/subscriptions/I-need-Selecting/resourcegroups/blahblah/blahblah"
I cannot seem to get this command to execute in the outputted command - I cannot escape the " or ' in the awk effectively.
The output from the aks list --subscriptions command looks something like
[{"name": "foo", "resourceGroup": "bar", "subscription": "/subscriptions/I-need-Selecting/resourcegroups/blahblah/blahblah"},
... ]
Can anyone help?