AWK: how to reuse a result NR-times without removing END?
Posted
by HH
on Stack Overflow
See other posts from Stack Overflow
or by HH
Published on 2010-04-21T23:17:19Z
Indexed on
2010/04/21
23:23 UTC
Read the original article
Hit count: 200
How can I get all differences, not just one? I want to use the calculated result for each item in the third column. The dilemma is that if I remove END
I can print $3
but cannot have ave
. If I leave END
I have ave
but not all differences.
awk '{sum+=$3} END {ave=sum/NR} END {print $3-ave}' coriolis_data
-0.00964 // I want to see the rest differences, how?
coriolis_data
.105 0.005 0.9766 0.0001 0.595 0.005
.095 0.005 0.9963 0.0001 0.595 0.005
.115 0.005 0.9687 0.0001 0.595 0.005
.105 0.005 0.9693 0.0001 0.595 0.005
.095 0.005 0.9798 0.0001 0.595 0.005
.105 0.005 0.9798 0.0001 0.595 0.005
.095 0.005 0.9711 0.0001 0.595 0.005
.110 0.005 0.9640 0.0001 0.595 0.005
.105 0.005 0.9704 0.0001 0.595 0.005
.090 0.005 0.9644 0.0001 0.595 0.005
© Stack Overflow or respective owner