'Bash: compare if a value is contained within an interval

I got a text file which is tab separated and contains 2 columns like this:

1227637    1298347
1347879    1356788
1389993    1399847
...        ...

Now I got some values from an analysis and I'd like to check if these values are contained in my text file intervals. For example if I have 1227659, which is contained in the first interval, I'd like the bash-script to print to std out something like:

1227659 is contained between 1227637 and 1298347

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source