What programming languages do you have available to you for doing this in? Do you have PERL? It'd only take about 10 lines or so of PERL.