huffgluons
Technical User
Hi everyone. I'm trying to write an awk script to read a "mostly" formatted file. A chunk of the input file is shown below:
Ca A 4861A -0.113 0.6733 He 2 1025A -2.425 0.0033 S II 1.037m -2.475 0.0029 Ar 3 517.5A -2.592 0.0022
Ca A 4340A -0.438 0.3190 He 2 992.4A -2.635 0.0020 S II 1.034m -2.178 0.0058 Ar 3 387.3A -2.867 0.0012
Ca A 4102A -0.692 0.1779 He 2 972.2A -2.810 0.0014 S 2 1256A -2.824 0.0013 Ar 3 517.4A -2.937 0.0010
Ca A 3970A -0.900 0.1100 He 2 4686A -2.088 0.0071 S 3 18.67m -0.371 0.3721 Ar 4 444.7A -2.124 0.0066
Ca A 3889A -1.078 0.0730 He 2 3203A -2.501 0.0028 S 3 33.47m -1.122 0.0661 Ar 4 392.0A -2.777 0.0015
Ca A 3835A -1.234 0.0510 He 2 2733A -2.791 0.0014 S 3 1720A -2.430 0.0033 Ar 4 859.3A -2.567 0.0024
I want a script that, given a name like "He 2 4686A" (second column, fourth row), will give the numbers -2.088 and 0.0071. The problem is I never know in which column this will appear. So I don't know what address the two numbers have.
I have no previous awk experience, but I think now is a great time to learn it.
Thanks.
Ca A 4861A -0.113 0.6733 He 2 1025A -2.425 0.0033 S II 1.037m -2.475 0.0029 Ar 3 517.5A -2.592 0.0022
Ca A 4340A -0.438 0.3190 He 2 992.4A -2.635 0.0020 S II 1.034m -2.178 0.0058 Ar 3 387.3A -2.867 0.0012
Ca A 4102A -0.692 0.1779 He 2 972.2A -2.810 0.0014 S 2 1256A -2.824 0.0013 Ar 3 517.4A -2.937 0.0010
Ca A 3970A -0.900 0.1100 He 2 4686A -2.088 0.0071 S 3 18.67m -0.371 0.3721 Ar 4 444.7A -2.124 0.0066
Ca A 3889A -1.078 0.0730 He 2 3203A -2.501 0.0028 S 3 33.47m -1.122 0.0661 Ar 4 392.0A -2.777 0.0015
Ca A 3835A -1.234 0.0510 He 2 2733A -2.791 0.0014 S 3 1720A -2.430 0.0033 Ar 4 859.3A -2.567 0.0024
I want a script that, given a name like "He 2 4686A" (second column, fourth row), will give the numbers -2.088 and 0.0071. The problem is I never know in which column this will appear. So I don't know what address the two numbers have.
I have no previous awk experience, but I think now is a great time to learn it.
Thanks.