This a function that I wrote to find and remove a portion of the
string!
You should be able to modify this to make it work. In the main part of the program you could read line by line from the file and send the line in to this function! I hope this helps, Good luck!
public static String RemoveSubstring(String s, String rs) {
// removes the first accurance of rs in a string
// and sends back the new string!
int len = s.length(), pos, rslen = rs.length();
String firsthalf, lasthalf, result;
pos = s.indexOf(rs, 0);
firsthalf = s.substring(0, pos);
lasthalf = s.substring(pos + rslen, len);
result = firsthalf + lasthalf;
return result;
}