Read/edit/Write text file
Hi all,
I have relatively little experience in Java. So to get straight to the point, I have a data set that looks as follows:
Code:
KKM model E zones bottom
Number of histories used for normalizing tallies = 13591000.00
Mesh Tally Number 44
COBALT Mesh tally for zones E28 to E17
This is a neutron mesh tally.
Tally bin boundaries:
Cylinder origin at 0.00E+00 0.00E+00 7.10E+02, axis in 0.000E+00 0.000E+00 1.000E+00 direction
R direction: 0.00 201.60
Z direction: 0.00 26.30 52.60 78.90 105.20 131.50 157.80 184.10 210.40 236.70 263.00 268.00 291.00
Theta direction (revolutions): 0.000 1.000
Energy bin boundaries: 0.00E+00 1.00E+36
R Z Th Result Rel Error
100.800 13.150 0.500 4.96666E-18 6.36428E-01
100.800 39.450 0.500 7.37615E-17 6.26284E-01
100.800 65.750 0.500 3.02569E-13 9.97876E-01
100.800 92.050 0.500 8.20526E-15 3.34284E-01
100.800 118.350 0.500 9.31723E-14 2.17791E-01
100.800 144.650 0.500 9.07843E-13 1.55635E-01
100.800 170.950 0.500 1.01972E-11 9.25421E-02
100.800 197.250 0.500 1.41342E-10 8.25055E-02
100.800 223.550 0.500 1.81634E-09 3.39385E-02
100.800 249.850 0.500 4.28239E-08 6.11518E-03
100.800 265.500 0.500 1.71720E-07 4.59028E-03
100.800 279.500 0.500 2.82212E-06 1.71333E-03
Mesh Tally Number 54
This is a neutron mesh tally.
Tally bin boundaries:
Cylinder origin at 0.00E+00 0.00E+00 7.10E+02, axis in 0.000E+00 0.000E+00 1.000E+00 direction
R direction: 0.00 201.60
Z direction: 0.00 26.30 52.60 78.90 105.20 131.50 157.80 184.10 210.40 236.70 263.00 268.00 291.00
Theta direction (revolutions): 0.000 1.000
Energy bin boundaries: 0.00E+00 1.00E+36
R Z Th Result Rel Error
100.800 13.150 0.500 3.92996E-19 6.46263E-01
100.800 39.450 0.500 5.32324E-18 5.89783E-01
100.800 65.750 0.500 2.39132E-13 9.99794E-01
100.800 92.050 0.500 5.46217E-16 3.68575E-01
100.800 118.350 0.500 6.21691E-15 2.21151E-01
100.800 144.650 0.500 6.15204E-14 1.62555E-01
100.800 170.950 0.500 6.85704E-13 1.02244E-01
100.800 197.250 0.500 9.52404E-12 9.64749E-02
100.800 223.550 0.500 1.29564E-10 2.72903E-02
100.800 249.850 0.500 3.10994E-09 5.51527E-03
100.800 265.500 0.500 1.41452E-08 3.93577E-03
100.800 279.500 0.500 1.96310E-07 1.76984E-03
Mesh Tally Number 64
Mesh tally for zones 28 to E17
This is a neutron mesh tally.
Note: This is only a (very) small extract. Exactly what it is, is an entirely different(and long) story:D.
What I need to do is to get it into a format with the "Mesh Tally Number #" as a heading and the tables in a new text file. I have figured out how to parse the text and am currently kind of stuck on writing it to a new file. What I haven't even started yet is to apply some sort of method to extract the necessary data. Excel isn`t any good as it is displayed in a completely useless way and given that the procedure needs to be applied to many of these files (all over 150kb, the sample given above is only 3 kb:( ) manually stripping out the necessary data isn`t feasible.
If I would be very grateful if somebody could help me with the code for reading in the data and writing into a new file with the possibility of applying some sort of algorithm for extracting the relevant data, though that will probably be left to me as the tables do change slightly in format later on.
Thanks for your advice :)