1234522
1567811
18810122
2133443
2455613
this would continue further toaround1000's of lines
####
1,23,45,2,2
1,56,78,1,1
1,88,101,2,2
2,13,34,4,3
2,45,56,1,3
####
1,1,22,2,2
1,23,45,2,2
1,46,55,2,2
1,56,78,1,1
1,79,87,2,2
1,88,101,2,2
2,1,12,2,2
2,13,34,4,3
2,35,44,2,2
2,45,56,1,3
####
!/software/bin/perl
use strict;
use warnings ;
while(<>){
my @line = split(/,/,$_);
my @splice = splice(@line, 3,8);
my $chr = shift @splice;#shifts the first element
my %hash;
$hash{$chr} = \@splice;
foreach my $key (sort keys %hash){
print $key, "," , $hash{$key}[0] ,",", $hash{$key}[1], "\n";
}
}
####
The input would be:
1,34,1,23,45,2,2
35,45,1,56,78,1,1
46,56,1,88,101,2,2
57,68,2,13,34,4,3
69,78,2,45,56,1,3