I have a vcf file with 60 animals (columns) and I would like to split these animals in 10 subset with 6 animals chosen randomly per group. I'm using the following script, but it's not working:
head -n 60 my.vcf | grep "^#" > header grep -v "^#" out.subgrupos.vcf > animals split -l 6 animals for i in x*;do cat header $i >$i.vcf && rm -f $i;done rm -f header animals
I need to keep the header in each file. Is there another way to do that?