I have a big file with over 1 million columns and 800 rows. The first row is the chromosome's name(Ha412HOChr01,Ha412HOChr02,.....Ha412HOChr17) with the SNP position on each chromosome. in Total their are 17 chromosomes. I want to extract columns for each chromosome (Ha412HOChr01,Ha412HOChr01,Ha412HOChr01,....,Ha412HOChr17) and store them in a separate file.
"Ha412HOChr01:180159" "Ha412HOChr01:210724" "Ha412HOChr01:303270" "Ha412HOChr01:303280"....... "Ha412HOChr17:303402"
0 1 0 0 ......0
0 1 0 0 ......0
0 1 0 0 ......0
0 2 0 0 ......0
0 1 1 1 ......1
0 2 0 0 ......0
my desired output for example for chromosome 1:
out.chrom1
"Ha412HOChr01:180159" "Ha412HOChr01:210724" "Ha412HOChr01:303270" "Ha412HOChr01:303280"
0 1 0 0
0 1 0 0
0 1 0 0
0 2 0 0
0 1 1 1
0 2 0 0
0 0 0 0
0 2 0 0
0 1 2 2