Shouldn't this be already handled by Perl or Shell scripts ?
_________________________