this is my first time posting so hope I am getting it right.
I am trying to write a simple shell script to print out columns of a dataset if column 2 is between +1000000 and -10000000 of a variable number (snp). Here is what I have:
SNPS="9000000 8000000"
for snp in $SNPS; do
awk '{if ($1 == 12 && $2 <= $((snp+1000000)) && $2 >= $((snp-1000000)))
print $1,$2,$3,$4,$5,$6,$7,$8}' file.txt > snp12_"${snp}"
cat snp12_"${snp}" | sort -u -k8 > snp12_"${snp}"_sorted
done
Although I know there are numbers in column 2 that fit these criteria, I am getting an empty resulting file. Any help would be appreciated. Thank you!