#!/usr/athena/bin/perl

$vax="DEC/VAXSTATION";		# what's a VAX?  (no uVAXen...)
$hst="/afs/net/admin/hosts/hstath.txt"; # source file

open (HST, $hst) || die "$0: can't open host list";

while (<HST>) {
    if (/$vax/ && !/^;/) {
	$count=0;
	@names=split(",",(split(/[: ]+/))[2]);
	$fname=$names[0];
	while (@names) {
	    if (shift(names) =~ /^(.*-.*[0-9].*)-/) {
		++$count;
		++$clust{$1};
	    }
	}
	if ($count==0) { ++$clust{"other"}; }
	if ($count>=2) { print STDERR "Whee: $fname has $count fields.\n"; }
    }
}

@cllist=%clust;
while (@cllist) {
    ($cl,$cnt)=(shift(@cllist),shift(@cllist));
    printf "%4d %s\n",$cnt,$cl if ($cnt > 1);
}
