#!/usr/bin/env perl
$groupid = 267;
open (YPCAT,"ypcat group |");
$group_count = 0;
$liststring = "";
while (<YPCAT>) {
    if (/:$groupid:/) {
	#print;
	$group_count++;
	chomp;
	@t = split/:$groupid:/;
	$liststring .= "$t[1],";
    }
}
#print $liststring, "\n";
@users = split(/,/, $liststring);
foreach $user (@users) {
    if ($user) { # eliminate blank user from final comma
	print $user, "\n";
	open (STAFF, "staff $user |");
	while (<STAFF>) {
	    #print;
	    if (/\s$user$/) {
		@t1 = split /, /;
		$last = $t1[0];
		$rest = $t1[1];
		@t2 = split(/\s+/, $rest);
		$first = $t2[0];
		print "$user = $first $last <$user\@jlab.org>\n";
		last;
	    }
	}
    }
}
print "wolin = Elliot Wolin <wolin\@jlab.org>\n";
exit;
