:
TMP1=/tmp/propdef1-$$
TMP2=/tmp/propdef2-$$
trap "rm $TMP1 $TMP2" 0

PATH=$PATH:~bbos/bin:~bert/bin
hxnormalize=`which hxnormalize || which normalize || echo hxnormalize`
hxpipe=`which hxpipe || which pipe || echo hxpipe`
hxunpipe=`which hxunpipe || which unpipe || echo hxunpipe`
hxextract=`which hxextract || which extract || echo hxextract`

class="propdef"

# Check for command line option -c
if [ "$1" == "-c" ]; then shift; class="$1"; shift; fi

# TMP1 is a sed program to replace <td> by tab
cat >$TMP1 <<EOD
s/\\\\n/ /g
s/\\\\t/ /g
s/ / /g
s/  */ /g
/^Aid ID /{s/^Aid ID /-/;h;n;}
/^(table/{g;a\\
-\\\\t
}
s/^(t[dh]$/-\\\\t/
s/^)table$/-\\\\n/
/^-/p
EOD

# TMP2 is a sed program to normalize white space in each tab-separated field
cat >$TMP2 <<EOD
s/  */ /g
s/	 /	/g
s/ 	/	/g
s/^ //
s/ $//
EOD

# Extract tables, make each table into a tab-separated line of fields,
$hxnormalize -x "$@" |\
 $hxextract table."$class" - |\
 $hxpipe |\
 sed -n -f $TMP1 |\
 $hxunpipe |\
 sed -f $TMP2

# Local variables:
# mode: ksh
# End: