perl -0777 -pe "substr $_, rindex($_,'</TABLE>'), 8, 'REPLACE'" x.html
In reply to Re: Match last instance of pattern by JStrom in thread Match last instance of pattern by techie411