Adding character and append last element of second column

Hi,
could you help me in processing this file under bash?
I need to add some text to the first line and then append the last element of the second columns.
The input file is tab separated while the output should be space separated.

input file is

1.00E-02 2.00E-02 4.465E+17
2.00E-02 3.00E-02 5.423E+16
3.00E-02 4.50E-02 1.218E+17
4.50E-02 6.00E-02 2.600E+16
6.00E-02 7.00E-02 9.135E+15
7.00E-02 7.50E-02 1.238E+14
...
9.00E-01	1.00E+00	6.238E+14

desired output

TEXT     A
1.00E-02 A
2.00E-02 A
3.00E-02 A
4.50E-02 A
6.00E-02 A
7.00E-02 A
...      A
1.00E+00 

Thanks in advance,
S

Hello f_o_555,

Not 100% clear to me, could you please try following and let me know if this helps you.

awk 'BEGIN{print "TEXT     A"} {print $1 FS "A"}'   Input_file

Thanks,
R. Singh

Hi,
thank you. it almost what I need.
In the very last row there should be the second column entry of the last row of the input.
the output should end as

9.00E-01	A
1.00E+00

Hello f_o_555,

Could you please try following and let me know if this helps you.

awk 'BEGIN{print "TEXT     A"} {print $1 FS "A"} END{print $2}'   Input_file

Thanks,
R. Singh

1 Like

Yes, thanks