{
awk -F= 'BEGIN { 
T["00"]="FORM ID"
T["01"]="FORM NAME"
T["02"]="FORM TYPE"
T["03"]="LINES"
T["04"]="PAGES"
T["05"]="PERIOD 1"
T["06"]="PERIOD 2"
T["07"]="REGS"
T["08"]="JAVASCRIPTS"
T["09"]="HIDDEN FLAGS"
T["10"]="EXTRA SUBMIT BAR"
T["11"]="L"
T["12"]="ID_DAT"
T["13"]="DESCRIPTION"
T["14"]="DATA TYPE"
T["15"]="LG"
T["16"]="AT"
T["17"]="NFORM"
T["18"]="LFIELD"
T["19"]="DS"
T["20"]="LGD"
T["21"]="FUNCTION"
	printf "%s^",T["00"]
}
!/"formsD00"/  { next }
$2!="" && substr($1,1,6)=="formsH" {
        if(substr($1,length($1)-1)!="00")
        {
                x=substr($1,length($1)-1)
                printf "%s^",T[x]
        }
}
$2!="" && substr($1,1,6)=="formsD" {
                printf "%s^",T[NR-1]
}
END {
	print ""
} ' $1 |
 awk -F"^" ' BEGIN {ttop("B&uacute;squeda en FORMS");bgcolor="#FFFFFF"}
NR==1 { print "<tr>";labels("##"); for (i=1; i<NF; i++) labels(trail($i))
print "</tr>"
next
}
{
print "<tr>";label(NR-1,"")
for (i=1; i<NF; i++)if (i==1) boton($i)
else label($i,"")
print "</tr>"
}
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
END { foot() } 
function boton(value)
{
	print "<td>"
	printf "<input type=\"submit\" style=\"width: 120; background-color: #ddd;\" value=\"%s\" name=\"T02\">\n",value
	print "</td>"
}
function label(value,sty)
{
	if(value+0) align=" align=\"right\""
	else align=""
printf "<td%s %s>",align,sty
printf "&nbsp;%s&nbsp;\n",trail(value)
print "</td>"
}
function labels(value)
{
print "<th>"
printf "&nbsp;%s&nbsp;\n",trail(value)
print "</th>"
}
function ttop(value)
{
print "<html>"
print "<head>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"
print "<meta name=\"GENERATOR\" content=\"Inhedo 4gt 1.0\">"
print "<meta name=\"ProgId\" content=\"Inhedo Form Generator\">"
print "<link rel=\"stylesheet\" href=\"../css/list.css\">"
printf "<title>%s</title>\n",value
print "</head>"
print "<center>"
print "<body>"
print "<tr><img border=\"0\" src=\"../logol.png\" width=\"200\" height=\"97\" style=\"background:#003399;border:solid 1px #FFFF00;\"></tr>"
printf "<H2>B&uacute;squeda en FORMS</H2>\n"
print "<form method=\"post\" action=\"../cgi-bin/formsbsc.cgi\" name=billform>"
print "<table id=\"customers\">"
printf "<input type=\"hidden\" value=\"Query\" name=\"B1\">\n"
print "<tr>"
print "</center>"
}
function foot()
{
print "</table>"
print "<b>"NR -1 " Registros</b>"
print "</center>"
print "</form>"
print "</body>"
print "</html>"
} ' - $2
awk ' BEGIN {
print "</body>"
print "</form>"
print "<form method=\"GET\" action=\"../forms.htm\">"
printf "<p align=\"center\"><input type=\"submit\" value=\"Continuar\" name=\"B1\" style=\"width: 100; height: 20; font-weight: bold; font-size: 10pt\"></p>\n"
print "</form>"
print "</body>"
print "</html>"
exit } ' - $2
} 
#> ../formslist1.html
#cat  ../formslist
