I want to match a list of numeric ids with two columns (each line has a different number/id) in file 1
>cat file1 1 23444 3 422255223 1 35541
and print only those lines from a larger file (file2) for which the 1st column matches and the 2nd column id is between the id in file 2.
>cat file 2 1 10 30 XP2 1 31 50 XP34 1 23000 25000 XP56 2 19000 30000 Xp9J
Running the script, Ideally if match is found it would output just the IDs from file 1 and then any of the match columns after the between column match e.g:
awk code file1 file2 1 23444 XP56
There is already a solution close to this question posted here: Awk - Print row if number is between column 1 and column 2
But I am struggleing to modify that script to accomodate 2 columns for the match and to query a file (file1) line by line.