Yeah i ended up using awk, some python for the date parsing and sorting, back to bash for grep and another thing i can't remember, then into the program that actually needed the data.
It was a mess, and I remember thinking it would be such a simple thing that was so much more complicated than i thought it would be.