#!/usr/athena/bin/perl

# Version 1.3

$columns = shift(@ARGV);

@columns = split("/", $columns);

while(<>){
    $line++;
    if(/List name/){
	if($inlist){
	    &store_list();
	}
	&clear_list;
	$inlist = 1;
	/: /;
	$listname = $';
	$listname =~ s/[\n\r]//g;
	$liststart = $line+4;
    }
    if(/List Title/){
	(@lt) = split;
	$lt = join(" ", @lt[2..$#lt]);
    }
    if($line == ($liststart-1)){
	($foo, @bar) = split;
	$ln2 = $foo;
    }
    if($inlist && $line >= $liststart){
	next if(!/\d/);
	next if (/Z E N I T H/);
	($blank, $ln, $data) = split;
	$data = $ln if $blank;
	next if !$data;
	push(@list, $data);
    }
}

&store_list;

foreach $c (@columns){
    print("$c\n$lists{$c}\n\n");
}

sub clear_list { @list = (); $listname = ""; }
sub store_list {
    $lists{"ALL"} .= "$listname\n";
    $lists{$listname} = join("\n", @list);
    $lists{$ln2} = join("\n", @list);
}
