Rosetta Code/Count examples: Difference between revisions
Content added Content deleted
Line 3,037: | Line 3,037: | ||
API=$SITE/mw/api.php |
API=$SITE/mw/api.php |
||
PAGES=$SITE/mw/index.php |
PAGES=$SITE/mw/index.php |
||
query="$API?action=query" |
query="$API?action=query" |
||
query+=$(printf '&%s' \ |
query+=$(printf '&%s' \ |
||
Line 3,043: | Line 3,042: | ||
cmtitle=Category:Programming_Tasks \ |
cmtitle=Category:Programming_Tasks \ |
||
cmlimit=500) |
cmlimit=500) |
||
total=0 |
total=0 |
||
while read title; do |
while read title; do |
||
Line 3,051: | Line 3,049: | ||
printf '%s: %d examples.\n' "$title" "$tasks" |
printf '%s: %d examples.\n' "$title" "$tasks" |
||
let total+=tasks |
let total+=tasks |
||
done < <(curl -s "$query&format=json" |
done < <(curl -s "$query&format=json" \ |
||
| jq -r '.query.categorymembers[].title') |
|||
printf '\nTotal: %d examples.\n' "$total"</lang> |
printf '\nTotal: %d examples.\n' "$total"</lang> |
||