Grab SNPs and convert them to sorted BED. Once they are in BED format, you can convert your positions to BED and do a BEDOPS bedmap operation to map SNP IDs that associate with positions.
For example, here is a way to download dbSNP v150 for hg19 and convert it to BED with BEDOPS vcf2bed:
$ wget -qO- ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b150_GRCh37p13/VCF/All_20170710.vcf.gz | gunzip -c - | vcf2bed --sort-tmpdir=${PWD} --max-mem=2G - > hg19.dbSNP150.bed
You'd modify this for your reference genome, if you're not working with hg19.
Then convert your positions to a sorted BED file, using awk and BEDOPS sort-bed:
$ awk -vOFS="\t" '{ print "chr"$1, ($2 - 1), $2; }' positions.txt | sort-bed - > positions.bed
This assumes that the chromosome number is strictly numerical (i.e., Ensembl format, and not UCSC format). So we add a chr prefix to this number, so that the chromosome names in the BED file positions.bed will match the chromosome names in the BED file hg19.dbSNP150.bed. Modify this depending on the format of chromosome names in your original positions.txt file.
Finally, you can map positions to SNP IDs:
$ bedmap --echo --echo-map-id --delim '\t' positions.bed hg19.dbSNP150.bed > answer.bed
The file answer.bed will have the positions in the first three columns, and the SNP rs-ID in the fourth, last column.
Did you check these posts?