Created
January 20, 2021 20:11
-
-
Save ps-przemekaugustyn/3f22dc462d82e667964eea1e05303ccd to your computer and use it in GitHub Desktop.
Extract from JSON (JQ)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# epoch as a filename | |
startf=$(basename -- $1) | |
# convert back to time | |
starttime=$(date -j -r "${startf%.*}") | |
endf=$(basename -- $2) | |
endtime=$(date -j -r "${endf%.*}") | |
echo from: $starttime | |
echo to: $endtime | |
# extract from JSON | |
startcount=$(cat $startf |jq -r '.data.sources[0].results_count_all') | |
endcount=$(cat $endf|jq -r '.data.sources[0].results_count_all') | |
echo $startcount $endcount | |
echo overall requests $((endcount-startcount)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment