I have a list of integers from 1 to 6k, and I have a list of ranges (start/stop) with a third value I'd like to assign to each integer within those ranges. The list of ranges might look like this, although in reality I will have hundreds of unique ranges per file to check against each integer.
5277 5305 72 5306 5331 50 5332 5361 57 5368 5389 55
What I'd like to do is print the integer and the value from the third column of the range table, or print a "0" for integers not falling in any range.
1 0 2 0 3 0 ... 5277 72 5278 72 5279 72 ... 5305 72 5306 50 5307 50 ... 6000 0
Any thoughts on how to get the intended results? I was thinking of writing 'for' loops for integers 1-6000 with embedded 'if' files to check each integer in each range, but don't want to individually write hundreds of 'if' statements, just to have to change them for the next dataset. Maybe this could be done by creating a table of ranges in MySQL and checking each of 6000 values against the table and printing the result, but I'm not that familiar with MySQL so it would take me much longer to figure out.