To be honest, the easiest way to do that is with the unix utility 'sed', or with the find/replace functionlaity of most any text editor. If you really want to use
Java, look at the regexp package, and I believe there's a String.replace method as well.