#!/bin/sh

SEP=sep.perl

${SEP} allgre01.tex allgre .tex | grep -f grepfile > contents
${SEP} allgre02.tex allgre .tex | grep -f grepfile >>  contents
${SEP} allgre03.tex allgre .tex | grep -f grepfile >>  contents
${SEP} allgre04.tex allgre .tex | grep -f grepfile >>  contents
${SEP} allgre05.tex allgre .tex | grep -f grepfile >>  contents
${SEP} allgre06.tex allgre .tex | grep -f grepfile >>  contents
${SEP} allgre07.tex allgre .tex | grep -f grepfile >>  contents
#${SEP} allgre10.tex allgre .tex | grep -f grepfile >>  contents

cp allgre00.tex allgre.0.tex
cp allgre.syntax.tex allgre.594.tex

for FILE in allgre.[0-9].tex allgre.[0-9][0-9].tex allgre.[0-9][0-9][0-9].tex
do
	IFS='.'; set $FILE; IFS=' '; NUMBER=$2
        HTML=`echo ${FILE} | sed -e s/.tex/.html/` export HTML
	rm -f $HTML
        tex2asc --xterm --html-plus -f $FILE >> /dev/null
        textref < ${HTML} > ./temp-file
        mv ./temp-file ${HTML}
        app $HTML
	echo -n "[$NUMBER] "
done
