Match to range in files

I am trying to create a script that will use the position in column A ($1) in 48850.txt and search for it in columns B ($2) in gene.txt. Then when it finds a match it copies the text in column A ($1) and places it in column C ($3) of 48850.txt. I have attached the files. Thank you :).

 The first position in 48850.txt is chrX:138982061 and that is between chrX: 13789061-13956831 (row 25325 in gene.txt) and the text in column A ($1) is GPM6B.  So that text would be copied to column D ($4) of 48850.txt.

48850.txt
chrX:138982061	138982120	 A_16_P21610256    GPM6B 

Thank you :).

  1. Sort 48850.txt on column 1 and gene.txt on column 2, then run join on them to find the hits, and use cut to rearrange output.
  2. Or if one file is unique on the column, load it into an associative arry in ksh, bash or awk, then go through the other file looking for matches and writing the output from the match and input.
  3. Get an SQL text tool like HXTT CSV JDBC and do an SQL SELECT JOIN to make the new file.

What does it mean,

Do you mean that 138982061 is in the range 13789061..13956831?
(It isn't.)