Change SNPID in vcf file with awk
Hi, I have a VCF file with SNP IDs like this:
AX-14233402__rs35404821
AX-37499887__rs74704183
AX-36783275__rs11997571
I would like to change the SNP IDs to have only the IDs without the AX-... term:
rs35404821
rs74704183
rs74704183
Is there any solution for this? I tried with a gsub command, but nothing changed:
awk '{gsub(/AX*_rs/,"rs"); print}' datafile.vcf > datafile_ID.vcf
• 1,551 views
•
link
1 answer
awk -F '\t' '/^#/ {print;next;} {OFS="\t";gsub(/.*__rs/,"rs",$3);print}' < in.vcf
• 0 views
•
link
Log in to answer this question.
Do not delete posts when they've been addressed. If one or more solutions worked, accept them using the green check mark.
can you try one of these three?