Code:
$
$
$ cat data.txt
3386(11:11,Ani:0,Bri:1,ch:1,Jwe:0,Jor:0,LP:0,Lo:0,NS:1,al:1,bo:0,boy:0,bru:0,sh:0,cor:1,dum:0,ery:0,mac:0,mic:0)
3387(11:11,Ani:1,Bri:0,ch:1,Jwe:2,Jor:0,LP:0,Lo:0,NS:3,al:1,bo:0,boy:0,bru:0,sh:0,cor:4,dum:0,ery:1,mac:0,mic:0)
386(11:11,Ani:1,Bri:1,ch:1,Jwe:4,Jor:0,LP:0,Lo:3,NS:1,al:1,bo:7,boy:0,bru:9,sh:0,cor:1,dum:0,ery:0,mac:0,mic:0)
$
$ perl -lne '/^(\d+).*?,(.*)\)$/;
push @col, $1;
@x = split(/,/, $2);
@row = map { ($y = $_) =~ s/:\d+$//; $y } @x if $.==1;
push @data, [ map { s/.*://; $_ } @x ];
END {
print "\t", join("\t", @col);
foreach $i (0..$#row) {
print $row[$i],"\t",join("\t", map{$_->[$i]} @data)
}
}' data.txt
3386 3387 386
Ani 0 1 1
Bri 1 0 1
ch 1 1 1
Jwe 0 2 4
Jor 0 0 0
LP 0 0 0
Lo 0 0 3
NS 1 3 1
al 1 1 1
bo 0 0 7
boy 0 0 0
bru 0 0 9
sh 0 0 0
cor 1 4 1
dum 0 0 0
ery 0 1 0
mac 0 0 0
mic 0 0 0
$
$
$