##
A1 text1 NY:SG:AUS Jan 01
A2 text2 LN:NY Feb 02
A3 text3 SG Mar 03
####
use warnings;
use strict;
my %hash;
while (){
chomp;
my ($key, $col2, $col3) = split;
push @{ $hash{$key}{$col2} }, $col3;
}
for my $k (keys %hash){
for (keys %{ $hash{$k} }){
my $cols3 = join ':', @{ $hash{$k}{$_} };
print "$k $_ $cols3\n";
}
}