#! /usr/bin/gawk -f # Last edited on 2002-02-23 16:05:11 by stolfi BEGIN { abort = -1; recipe = 0; totrecipes = 0; } (abort >= 0) { exit abort; } /^[#][#][ ]+[0-9]+[-]/ { recipe++; totrecipes++; next; } /^[ ]*([#]|$)/ { next; } /^[0-9]/ { page = $1; if (match(page, /^[0-9]+[rv][0-9]?[-]/)) { page = substr(page, 1, RLENGTH-1); } else { printf "? `%s'\n", $0 > "/dev/stderr"; abort = 1; exit 1; } if (page != opage) { print_it(); opage = page; nrecipes = 1; orecipe = recipe; } else if (recipe != orecipe) { nrecipes++; orecipe = recipe; } next; } /^[ ]*([#]|$)/{ next; } END{ if (abort >= 0) { exit abort; } print_it(); printf "total %d recipes\n", totrecipes > "/dev/stderr"; } function print_it() { if (opage != "") { printf "%-8s %3d\n", opage, nrecipes; } }