#!/bin/sh
if test $# -ne 1; then
echo 'Usage: vtxget2tk
' >&2
exit 1
fi
cd "$1" || exit
gawk '
/^{PAGE [0-9][0-9][0-9]\/[0-9][0-9]?}/ {
if (outfile) {
close(outfile)
}
page = substr($0, 7, 3) + 0
subpage = substr($0, 11, 2) + 0
if (!subpage) {
subpage = 1
}
outfile = page "--" subpage "-"
next
}
{
print > outfile
}
'