Hello every one, I ma facing a problem with this file
position: 1 neighbors: 5
xxxx A 1 G L -135.185 178.150 179.885 0.000 0.000 0.0 +00 1 0.000 P 1 F 1 xxxx A 2 S L -49.668 -31.158 177.985 0.000 0.000 0.0 +00 1 0.000 P 1 F 1 xxxx A 3 M L -84.632 -45.215 177.518 0.000 0.000 0.0 +00 1 0.000 P 1 F 1 xxxx A 1 G L -115.240 -69.349 -171.360 0.000 0.000 0.0 +00 1 0.000 P 1 F 2 xxxx A 2 S L -84.776 -143.809 173.303 0.000 0.000 0.0 +00 1 0.000 P 1 F 2 xxxx A 3 M L -50.674 158.544 177.747 0.000 0.000 0.0 +00 1 0.000 P 1 F 2 xxxx A 1 G L -106.682 126.232 177.885 0.000 0.000 0.0 +00 1 0.000 P 1 F 3 xxxx A 2 S L -20.124 24.502 -179.585 0.000 0.000 0.0 +00 1 0.000 P 1 F 3 xxxx A 3 M L -60.092 2.018 -178.549 0.000 0.000 0.0 +00 1 0.000 P 1 F 3 xxxx A 1 G L -115.172 -16.017 -179.179 0.000 0.000 0.0 +00 1 0.000 P 1 F 4 xxxx A 2 S L -143.860 148.913 -179.781 0.000 0.000 0.0 +00 1 0.000 P 1 F 4 xxxx A 3 M L -81.755 -23.354 -174.564 0.000 0.000 0.0 +00 1 0.000 P 1 F 4 xxxx A 1 G L -71.907 147.690 -178.617 0.000 0.000 0.0 +00 1 0.000 P 1 F 5 xxxx A 2 S L -81.417 52.986 179.983 0.000 0.000 0.0 +00 1 0.000 P 1 F 5 xxxx A 3 M L -83.126 -56.051 178.109 0.000 0.000 0.0 +00 1 0.000 P 1 F 5
I need to average the numeric values in column 6 and 7 (I did not count the spaces) such that I get three lines. Line 1 is the average of of the first
line of each of the five groups, line 2 is the average of the second line of each of the five groups and so one. please help me, I am new to Perl and I
have been struggling with this file for some time.
many thanks
2018-04-04 Athanasius added code tags
In reply to averaging a group of lines with numeric value in a text file by Anas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |