jq filter condition

AWS example:
aws cloudwatch list-metrics | jq -r '."Metrics" | .[] | select(.MetricName == "CPUUtilization")'
aws cloudwatch list-metrics | jq -r '."Metrics" | .[] | select(.MetricName == "CPUUtilization") | ."Dimensions" | .[] | select(.Name == "InstanceId") | ."Value"'
{
  "rel": "edit",
  "type": "application/atom+xml",
  "href": "https://www.blogger.com/feeds/3325322079154148081/posts/default/7205353922662111389"
}
{
  "rel": "self",
  "type": "application/atom+xml",
  "href": "https://www.blogger.com/feeds/3325322079154148081/posts/default/7205353922662111389"
}
{
  "rel": "alternate",
  "type": "text/html",
  "href": "https://catonrug.blogspot.com/2018/04/add-swap-file-centos-7-amazon-aws.html",
  "title": "Add swap file to CentOS 7, Amazon AWS"
}
{
  "rel": "replies",
  "type": "application/atom+xml",
  "href": "https://catonrug.blogspot.com/feeds/4805867199201908752/comments/default",
  "title": "Post Comments"
}
I want to filter out only the link which contains "rel": "alternate"

Implementation:
curl -s "https://catonrug.blogspot.com/feeds/posts/default/-/AWS?alt=json-in-script" | sed "s/gdata.io.handleScriptLoaded(//;s/);$//" | jq '.["feed"] | .["entry"] | .[] | .link[] | select(.rel == "alternate")'
Or:
curl --location --request POST 'http://127.0.0.1/api_jsonrpc.php' \
--header 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "method": "alert.get",
    "params": {
        "output": "extend"
    },
    "auth": "5f41626816fa83ed0201290c19a57261",
    "id": 1
}

' | jq '.result[] | select (.status == "1") | .message '

No comments: