I need to pull a substring from JSON. In the JSON document below, I need the end of the value jq '.[].networkProfile.networkInterfaces[].id'In other words, I just need to A10NICvw4konls2vfbw-datago to another command. I can't figure out how to pull a substring using grep. I see examples of regular expressions, but have not succeeded.
[
{
"id": "/subscriptions/blah/resourceGroups/IPv6v2/providers/Microsoft.Compute/virtualMachines/A10VNAvw4konls2vfbw",
"instanceView": null,
"licenseType": null,
"location": "centralus",
"name": "A10VNAvw4konls2vfbw",
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/blah/resourceGroups/IPv6v2/providers/Microsoft.Network/networkInterfaces/A10NICvw4konls2vfbw-data",
"resourceGroup": "IPv6v2"
}
]
}
}
]
Adoyt source
share