in reply to Re: Count in intervals
in thread Count in intervals

And if both files are really huge, you use a modified Merge sort-type algorithm. (The last pass does the interval calculation instead of just sorting items.)