export PRAXIS=/home/phil/praxis awk ' # permuted table of contents (page "permuted") BEGIN { FS = "\n"; RS = "" split("Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec", monthname, ":") } $1 ~ /^number\t[1-9][0-9]*$/ { for (i in val) delete val[i] for (i=1; i<=NF; i++) if (split($i, f, /\t/) == 2) val[f[1]] = f[2] if (val["ptitle"] == "") val["ptitle"] = val["title"] if (val["pblurb"] == "") val["pblurb"] = val["blurb"] for (i in words) delete words[i] for (i in pwords) delete pwords[i] n = split(val["title"] ": " val["blurb"], words, / /) if (split(val["ptitle"] ": " val["pblurb"], pwords, / /) != n) print "error: unmatched word count at " val["number"] | "cat 1>&2" for (i=1; i<=n; i++) { # main loop to generate rotated permutations sortkey = suffix = "" for (j=i; j<=n; j++) { sortkey = sortkey " " pwords[j] suffix = suffix " " words[j] } sortkey = substr(sortkey,2); suffix = substr(suffix,2) prefix = "" for (j=1; j%d%02d %s %d" \ "%s%s" \ "exercise " \ "solution " \ "codepad\n", sortkey, val["number"], val["pubday"], monthname[val["pubmon"]], val["pubyear"], prefix ? prefix : " ", suffix, val["pubyear"], val["pubmon"], val["pubday"], val["file"], val["pubyear"], val["pubmon"], val["pubday"], val["file"], val["soln"], val["codepad"] } } ' $PRAXIS/praxis.info | awk '$0 !~ /^(a|an|and|as|at|but|by|for|from|his|in|it|my|of|on|or|our|per|that|the|to|which|with|A|An|And|As|At|But|By|For|From|His|In|In|My|Of|On|Or|Our|Per|That|The|To|Which|With) /' | sort -f | cut -f2 >$PRAXIS/pages/permuted ed -s $PRAXIS/pages/permuted <<'EOF' 0a . $a
. w q EOF