Hi,
You could do something like this:
Open the file, and place it in an array, and get the size:
$fcontents = file( $cfile );
$lines = sizeof($fcontents);
then, loop through the array untill you find the first line with </table> in it, using position:
$i=0;
while (! strpos("</table>", $cfile[$i] ))
{
$i++
}
Now you have the line which actually holds the </table> tag. Using strpos you can get the position of the tag, and read the substrin. Then you can start writing to the file again, untill you reach the end of file.
I am off to bed (midnight here), but I think you can get started with this?
It is certainly possible, but it will take some coding, I am afraid. Have a look at file and string manipulation functions in the manual.
J.