#!/bin/perl --
$num = 1;
$grp = 0;
while(<>){
chomp;
split(/\t+/);
if (/^\s*$/){
} elsif (/^G/){
print "G\t$grp\t$_[2]\t$_[3]\t$_[4]\t$_[5]\t$_[6]\n";
$grp++;
} elsif (/^M/){
$_[6] =~ s/-//g;
print "M\t$num\t$_[2]\t$_[3]\t$_[4]\t$_[5]\t$_[6]\n";
$num++;
} else {
print "$_\n";
}
}