wrote quick R script to generate range queries