The One
The One

Reputation: 2341

How to grep the specific value from the output with shell script?

I have a output like this

{
    "Tags": [
        {
            "ResourceType": "instance",
            "Value": "dev",
            "Key": "Group"
        },
        {
            "ResourceType": "instance",
            "Value": "web",
            "Key": "Name"
        }
    ]
}

With shell script, how can i get the "web" value? In other words, i only want to get the value if the "Key" equals "Name"

Upvotes: 0

Views: 34

Answers (1)

nbari
nbari

Reputation: 27005

You could use jq for example:

command | jq ".Tags[1].Value"

Upvotes: 1

Related Questions