creating population AF from set of individuals in 1000 genomes population?
bcftools has a plugin called fill-tags which should do the job for you easily, without having to mess around with lots of complicated bash scripting.

You could do something along the lines of this, presuming you have a .vcf file with all the IBS individuals in it:

bcftools +fill-tags in.vcf.gz -Oz -o out.vcf.gz


This will give each position in the .vcf file new INFO tags, one of which will be allele-frequency. 

You can then pull off the frequency for a particular variant (CHR:POS) by:

bcftools query -t CHR:POS -f'%CHROM\t%POS\t%AF\n' out.vcf.gz