in reply to Unique Values within AOH

Obligatory one-liner:
perl -F: -lane "$F[0] eq q|T| and $team=$F[1]; $F[0] eq q|P| and $h{$ +team}{$F[1]}++}{for my $t(sort keys %h){print $t, qq|\t\[|, join( qq| +, |, sort keys %{$h{$t}}),qq|\]|}" Your-Data.txt MARINERS [GRIFFEY, PEREZ] PHILLIES [ROSE] REDS [BENCH, GRIFFEY, PEREZ, ROSE]
Substitute single quotes for double, if running on Linux.

                "From there to here, from here to there, funny things are everywhere." -- Dr. Seuss