json=$( curl -G \ -d 'format=json' \ -d 'formatversion=2' \ -d 'action=wbcheckconstraints' \ -d 'id=Q64' \ https://www.wikidata.org/w/api.php ) withDetail=$( printf '%s' "$json" | jq -c . | wc -c ) withoutDetail=$( printf '%s' "$json" | jq -c ' del( .. | objects | select(has("constraint")) | .constraint | (.detail, .detailHTML) ) ' | wc -c ) awk \ -v "withDetail=$withDetail" \ -v "withoutDetail=$withoutDetail" \ 'END { removed = withDetail-withoutDetail printf "%2.2f%%\n", 100 * removed / withDetail }' < /dev/null