BASE=`pwd`
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR
LNK=../js/lnk.js
ihmq newform h00^ d00^H d01^ d02^ | awk -F^ ' 
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
li[$1]=="" {li[$1]=0; next }
{
	optv[$1""li[$1]]=trail($3)
	optt[$1""li[$1]++]=trail($4)
}
END {
print "var li=new Array()"
print "var optv=new Array()"
print "var optt=new Array()"
for (i in li)
	{
		printf "li[\"%s\"]=%d\n",i,li[i]
		for (j=0;j<li[i];j++) printf "optv[\"%s%d\"]=\"%s\"\noptt[\"%s%d\"]=\"%s\"\n",i,j,optv[i""j],i,j,optt[i""j]
	}
} ' >$LNK
