How can I match values in one file to ranges from another?

if the data file sizes are not huge, there is a simpler way

$ join input1 input2 | awk '$5<$4 && $3<$5 {print $2, $5-$3+1}'

B100002 32
B100043 15
B123465 3

Leave a Comment