#$table = 'ObjectInfoFlags';
$table='ObjectQualityFlags';
$table=$ARGV[1];
#$table = 'ImageFlags';
#    <TABLE name="DetectionFlags">
#    <TABLE name="DetectionFlags2">
#    <TABLE name="DetectionFlags3">
#    <TABLE name="ObjectInfoFlags">
#     <TABLE name="ObjectFilterFlags">

#     <TABLE name="ForcedGalaxyShapeFlags">

$go = 0;
while (<>) {




if ($_ =~ /\<T/) {
    if ($_ =~/TABLE name/) {
	if ($_ =~ /$table"/ ) {
	    $go = 1;
	} else {
	    $go = 0;
	}
    } 
    elsif ($_ =~/TABLEDAT/) {
	$donothing = 1;
    }
    else {
	if ($go == 1) {
	$_ =~s /\<TR\>/|/g; 
	$_ =~s /\s+\<TD\>/|/g;
	$_ =~s /\<TD\>/|/g; 
	$_ =~s /\<\/TR\>/|/g; 
	$_ =~s /\s+\<\/TD\>/|/g;
	$_ =~s /\<\/TD\>/|/g;
	$_ =~s /^\s+//;

 	print $_;
	}
    }
}

}
