#!/bin/sh

TMPFILE=lines.txt
SORTFILE=sortlines.txt

for file in ../output/pack/*.html; do
    name=`basename $file`
    [ ${#name} -gt 8 ] && continue
    echo '***' ${name} '***'
    nkf -w ${file} | grep '<sub' | sed -e 's/.*id="\([^"]\+\)".*/\1/g' | awk -F. '{printf("%d.%02d.%03d\n", $1,$2,$3)}' > ${TMPFILE}
    sort ${TMPFILE} > ${SORTFILE}
    diff ${TMPFILE} ${SORTFILE}
done

rm -f ${TMPFILE} ${SORTFILE}
