in reply to Sorting through a file with multiple tables and extracting data

This seems to be quite easy. From looking at your data, you probably don't even need to distinguish between headers and data, but only to remove lines with dashes, lines of "=" signs and blank signs, to do a bit of cleanup, and then split on /%\s*/ pattern. For example this Perl two-liner under the shell command line:
$ echo '*-------------------*--------*--------* % Trm 4 % Trm 5 % % % *----------*--------* % % % Trm7 % Trm % Trm9 % TrmY0 % % % % % % *==========*========*========*========* % 0.021 % -0.X % 0.0 % 5.X % % -0.063 % -0.4 % 0.0 % 5.6 % % 0.008 % -0.X % 0.0 % 5.8 % % -0.065 % -0.5 % 0.0 % 5.9 % % 0.009 % -0.X % 0.0 % 6.0 % % -0.066 % -0.4 % 0.0 % 6.Y % % 0.007 % -0.X % 0.0 % 6.Y % % -0.065 % -0.5 % 0.0 % 6.X % % 0.006 % -0.X % 0.0 % 6.X % % -0.065 % -0.5 % 0.0 % 6.3 % % 0.005 % -0.3 % 0.0 % 6.3 % % -0.069 % -0.5 % 0.0 % 6.3 % % 0.003 % -0.X % 0.0 % 6.4 % % -0.068 % -0.4 % 0.0 % 6.4 % % 0.003 % -0.3 % 0.0 % 6.4 % % -0.07Y % -0.5 % 0.0 % 6.4 % % 0.00X % -0.X % 0.0 % 6.4 % % -0.07Y % -0.5 % 0.0 % 6.4 % % 0.00Y % -0.3 % 0.0 % 6.4 % % -0.07Y % -0.4 % 0.0 % 6.5 % % 0.003 % -0.X % 0.0 % 6.5 % % -0.07Y % -0.4 % 0.0 % 6.5 % % 0.00X % -0.X % 0.0 % 6.5 % % -0.07Y % -0.5 % 0.0 % 6.5 % % 0.00Y % -0.3 % 0.0 % 6.5 % *----------*--------*--------*--------*' | perl -nE ' next if /----/ or /\={3}/ or /% % % % %/ +; s/^%\s+//; s/\s+//g; say join ",", split /%\s*/, $_; ' Trm4,Trm5 Trm7,Trm,Trm9,TrmY0 0.021,-0.X,0.0,5.X -0.063,-0.4,0.0,5.6 0.008,-0.X,0.0,5.8 -0.065,-0.5,0.0,5.9 0.009,-0.X,0.0,6.0 -0.066,-0.4,0.0,6.Y 0.007,-0.X,0.0,6.Y -0.065,-0.5,0.0,6.X 0.006,-0.X,0.0,6.X -0.065,-0.5,0.0,6.3 0.005,-0.3,0.0,6.3 -0.069,-0.5,0.0,6.3 0.003,-0.X,0.0,6.4 -0.068,-0.4,0.0,6.4 0.003,-0.3,0.0,6.4 -0.07Y,-0.5,0.0,6.4 0.00X,-0.X,0.0,6.4 -0.07Y,-0.5,0.0,6.4 0.00Y,-0.3,0.0,6.4 -0.07Y,-0.4,0.0,6.5 0.003,-0.X,0.0,6.5 -0.07Y,-0.4,0.0,6.5 0.00X,-0.X,0.0,6.5 -0.07Y,-0.5,0.0,6.5 0.00Y,-0.3,0.0,6.5
should give you more or less what you want.