If you have disk space, you can set up a local copy of dbSNP for your assembly of interest, e.g. hg38
:
$ VCF=ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh38p7/VCF/common_all_20180418.vcf.gz
$ wget -qO- ${VCF}
| gunzip -c -
| convert2bed --input=vcf --sort-tmpdir=${PWD} -
| awk '{ print "chr"$0; }' -
| starch --omit-signature -
> common_20180418.starch
Then you can query your variants.vcf
file against this dbSNP file any time you want:
$ bedops --element-of 1 common_20180418.starch <(vcf2bed < variants.vcf) | cut -f4 > answer.txt
If you want the BED records along with the rsId:
$ bedops --element-of 1 common_20180418.starch <(vcf2bed < variants.vcf) > answer.bed
If you have more disk space and more prep time, you can download a local copy of all SNPs:
$ VCF=ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh38p7/VCF/All_20180418.vcf.gz
$ wget -qO- ${VCF} | ...
The difference between "All" and "common" dbSNP sets is described in this document.
The example you are showing is not a vcf file. So, is the example you've posted realy the data you have?
Duplicate of: - Get Rs Number Based On Position
For annotating with dbsnp (or any other relevant vcf/bed), you can use bcftools annotate function or bedtools intersect function, provided variants are in vcf. OP is not in vcf.