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

Using jq with the value of a variable as field value

$
0
0

I have a JSON file which I got via curl with hourly energy prices.

I can output the price for 6 o'clock withjq '.energy | .todayHours | .[6] | .priceIncludingVat'< "$JSON"

I get the actual hour via date command: HOUR=$(date '+%-H')

How do I get the price for the actual hour? I have no clue how to insert the value of $HOUR into the jq query instead of the "6"

Thanks a lot!

Played around with different things I found e.g. with the "--arg" option but got nowhere, but maybe I tried them a wrong way :-(


Viewing all articles
Browse latest Browse all 657

Trending Articles



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