Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 584

JSON JQ - filter with two statements

$
0
0

I'm using the below which is working perfectly but I want to add one more variable to the filtering, preferably "contains" as I want to filter this one based on a OS field which contains different strings:

curl -H "Accept: application/json; indent=4" -H "Authorization: Token $token" "$url_devices" -k | jq -r --arg device "$device" '.results[] | select(.cluster.name == $cluster) | .primary_ip.address'

Thank you in advance! I tried the following code, but it didn't work:

curl -H "Accept: application/json; indent=4" -H "Authorization: Token $token" "$url_devices" -k | jq -r --arg device "$device" '.results[] | select(.cluster.name == $cluster AND .cluster.os == $os) | .primary_ip.address'


Viewing all articles
Browse latest Browse all 584

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>