Yep, perl and python are on my to do list and I may well do this in one of those as a baby project to get started, but this does seem to be the easiest solution.