I have ~100 text files named *.txt in the following form:
=========================================================
rho_center e_center Mass Mass_0 R_e
1.0000e-03 1.1236e-03 1.5379e+00 1.6522e+00 1.0734e+01
J T/W Omega Omega_Kepler axes_ratio
0.0000e+00 0.0000e+00 0.0000e+00 3.5265e-02 1.0000e+00
J/M^2
0.0000e+00
=========================================================
yy| rhoc = 1.00000000e-03 ;
yy| rp_re = 1.00000000e+00 ;
yy| A_diff= 1.00000000e+00 ;
yy| Re = 1.07336268e+01 ;
yy| M0 = 1.65219709e+00 ;
yy| M = 1.53786062e+00 ;
yy| W = 2.10814073e-01 ;
yy| T = 0.00000000e+00 ;
yy| J = 0.00000000e+00 ;
yy| beta = 0.00000000e+00 ;
yy| M_R = 1.43275023e-01 ;
| === periods in msecs ==========
yy| Pa = inf ;
yy| Pe = inf ;
yy| td = 8.46677695e-01 ;
yy| PK = 8.77582921e-01 ;
yy| MDIV = 301 ; SDIV = 601;
I want to concatenate the values of rhoc and M in a single text file, like this:
rhoc M
0.001 1.537
... ...
0.004 2.328
I am a layman of bash and I try to use awk to do it but failed. How to write the bash script to do this job?