I have several hundred files in a directory.
The files are named fit###.txt. for example fit001.txt, or fit198.txt, etc.
They all have the format
#
# amp*exp( -1.0*|alpha|*x ) + C
# amp: 9.30743e+05 +/- 1.68%
# alpha: 0.78858 +/- 0.03033
# C: 0.0 Fixed
DATA MODEL exp amp 9.307434e+05 1.566825e+04 alpha 7.885796e-01 3.032517e-02
VARS INDEX X Y Y_MODEL NOISE
FORMAT %4d %.5e %.5e %.5e %.5e
1 1.00000e-02 9.26689e+05 9.23433e+05 2.50620e+04
2 1.00000e-02 9.39292e+05 9.23433e+05 2.47373e+04
3 5.00000e-02 8.82301e+05 8.94759e+05 2.50140e+04
4 1.00000e-01 8.58670e+05 8.60166e+05 2.50701e+04
5 2.00000e-01 8.10575e+05 7.94941e+05 2.39592e+04
6 4.00000e-01 6.48868e+05 6.78953e+05 2.33179e+04
7 8.00000e-01 4.87160e+05 4.95278e+05 2.29854e+04
8 1.20000e+00 3.82259e+05 3.61293e+05 2.27232e+04
I need to extract the values for alpha (with error), and the number portion from the filename and put them into a a new file with 4 columns.
number alpha error assignment
assignment must be pulled from yet another text file, called ass.tab with the format
VARS INDEX X_AXIS Y_AXIS DX DY X_PPM Y_PPM X_HZ Y_HZ XW YW XW_HZ YW_HZ X1 X3 Y1 Y3 HEIGHT DHEIGHT VOL PCHI2 TYPE ASS CLUSTID MEMCNT
FORMAT %5d %9.3f %9.3f %6.3f %6.3f %8.3f %8.3f %9.3f %9.3f %7.3f %7.3f %8.3f %8.3f %4d %4d %4d %4d %+e %+e %+e %.5f %d %s %4d %4d
NULLVALUE -666
NULLSTRING *
1 565.252 22.179 0.326 0.551 116.301 9.858 7073.210 5916.333 5.751 5.198 12.249 21.292 561 569 19 25 +3.751344e+05 +1.016324e+04 +1.324001e+07 0.00000 1 T145 1 1
2 171.115 24.382 0.039 0.230 130.103 9.843 7912.621 5907.307 3.840 4.982 8.179 20.407 168 174 21 28 +1.165875e+06 +1.029150e+04 +2.814185e+07 0.00000 1 None 2 1
3 733.694 25.353 0.640 6.502 110.403 9.837 6714.471 5903.331 4.630 7.506 9.860 30.746 734 734 26 26 +1.407034e+05 +1.041876e+04 +1.374500e+05 0.00000 1 G81 3 1
4 268.240 68.378 0.065 0.461 126.702 9.543 7705.770 5727.086 3.682 5.718 7.842 23.425 265 271 64 72 +7.714696e+05 +1.032846e+04 +2.170513e+07 0.00000 1 L7 4 1
where (following the header) the first number in the group is the number that would be pulled from the filename, and the T145, none, G81, L7, etc represent the respective assignment. I need the assignment to go with the correct number.
I am working in tcsh, and cannot change the shell.
I am way over my head. Any suggestions would be greatly appreciated.
Thanks.