We're living in 2004 now... perl is your friend for these kinds of things :)