Using awk to remove genotypes from a VCF file

posted on 08:28 AM on Friday 19 September 2014

Use the following awk command to strip the genotypes from a VCF files (when you just need the SNP information).

awk '{if($1 ~ /^#/ && $1 !~ /^#CHROM/) print $0; else print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $7 "\t" $8 "\t" $9;}'

bernett.net