export PRAXIS=/home/phil/praxis awk ' # themes (page "themes") BEGIN { FS = "\t" while (bash !~ /^number\t[1-9][0-9]*$/) getline split("Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec", monthname, ":") } /^number\t/ { number = $2 } /^file\t/ { file = $2 } /^pubmon\t/ { pubmon = $2 } /^pubday\t/ { pubday = $2 } /^pubyear\t/ { pubyear = $2 } /^title\t/ { title = $2 } /^ptitle\t/ { ptitle = $2 } /^blurb\t/ { blurb = $2 } /^pblurb\t/ { pblurb = $2 } /^exer\t/ { exer = $2 } /^soln\t/ { soln = $2 } /^extra\t/ { extra = $2 } /^codepad\t/ { codepad = $2 } # names[1..nthemes] = sorted theme names # counts[theme] = number of items in theme # themes[theme,1..counts[theme]] = output line by theme/number /^theme/ { counts[$2]++ themes[$2,counts[$2]] = sprintf(" %d%02d %s %d" \ "%s: \%s"\ "exercise" \ "solution "\ "codepad", number, pubday, monthname[pubmon], pubyear, pubyear, pubmon, pubday, file, title, blurb, pubyear, pubmon, pubday, file, pubyear, pubmon, pubday, file, soln, codepad) } END { for (i in counts) names[++j] = i printf "" n = asort(names) for (i=1; i<=n; i++) printf "%s (%d)%s", names[i], names[i], counts[names[i]], (i==n) ? "\n" : " · " printf "\n\n" for (i=1; i<=n; i++) { printf "\n\n", names[i], names[i] for (j=1; j<=counts[names[i]]; j++) printf "\n%s\n", themes[names[i],j] } printf "\n
" \ "%s
\n" } ' $PRAXIS/praxis.info >$PRAXIS/pages/themes