#!/usr/bin/perl
use strict;
use warnings;
my %types = ();
my %places = ();
while( <DATA> ){
chomp;
my ( $key, $type, $place ) = split /\;/, $_;
$types{$key}{$type} ++;
$places{$key}{$place} ++;
}
for my $key ( sort keys %types ){
my @types = sort keys %{ $types{$key} };
my @places = sort keys %{ $places{$key} };
print join( ';', $key, join( ',', @types ), join( ',', @places ) ), "\n";
}
__DATA__
MAP;CTRL;map1
MAP;GFT;map1
MAP;HLRC;map2
MRE-MGW;BROADCAST;cohosted1
MRE-MGW;GFT;cohosted1
OMAP;OMAP;omap1
OMAP;OMAPDB;omap1
OMAP;TRACESDB;omap2
SFE;DBSEI;sfe1;
SFE;DBSEI;sfe1
SFE;DBSEI;sfe1
SFE;GFT;sfe1;
SFE;TRACE_EVENTS;sfe1