Dear all:
I am new to awk and hope to know an efficient way to achieve following object:
suppose the dataset is as following:
a 40
b 10
c 10
c 20
b 20
c 30
a 30
c 20
what I want to do is
first to collect information on a
a 40
a 30
2nd, calculate a summary information, say mean, in this case it is 35. [(40+30)/2]=35
3rd, paste this information as the 3rd field in each row containing a, as following
a 40 35
a 30 35
finally the dataset looks like:
a 40 35
b 10 15
c 10 20
c 20 20
b 20 15
c 30 20
a 30 35
c 20 20
thank you in advance.
regards
will
I am new to awk and hope to know an efficient way to achieve following object:
suppose the dataset is as following:
a 40
b 10
c 10
c 20
b 20
c 30
a 30
c 20
what I want to do is
first to collect information on a
a 40
a 30
2nd, calculate a summary information, say mean, in this case it is 35. [(40+30)/2]=35
3rd, paste this information as the 3rd field in each row containing a, as following
a 40 35
a 30 35
finally the dataset looks like:
a 40 35
b 10 15
c 10 20
c 20 20
b 20 15
c 30 20
a 30 35
c 20 20
thank you in advance.
regards
will