I'm rather new to programming, and am attempting to combine lines from 2 files in a way that is way beyond my expertise - any help would be appreciated!
I need to take a file (file1) and add columns to it from another file (file2). However, a line from file2 should only be added to a given line in file1 if the number in file1column2 is between the numbers in file2column4 and file2column5. Therefore, I don't think I can use paste or join, and I can't figure out how to combine awk with getline or some if statement to get this to work. Any insight would be appreciated! Thanks so much!
file1
chr2L 22975381 -1.6723247 chr2L 22975381 -1.8917731 0.219448 0
chr2L 22975421 -1.526086 chr2L 22975421 -1.8669024 0.340816 0
chr2L 22975458 -1.7168827 chr2L 22975458 -1.9361134 0.219231 0
file2
2L gadfly exon 15748693 15748925 . -
2L gadfly exon 15748515 15748637 . -
2L gadfly exon 15746596 15748455 . -