Hi everybody:
I tried to do a script that average each five times, but i can't do it, and i've any mistake and i don't know where is.
#!/bin/gawk -f
BEGIN{FS = " ";c = 0;s = 0 ;};
{ s = s+$15; c = c++ };
if (c == 5){ a = s/5; print $1, $2, a};
the file is separated by spaces, and it is like:
20050803 00:00 215 0.081851 -0.50468 120.31015 -2.36 0 -1.922 0 -0.336 0.042 104.9 -1.16 105.9 288.26 391.407 15.49 25.4 -0.072 0 0.08^M -1.75 0.61
20050803 00:01 215 0.098517 -0.50461 120.30531 -2.36 0 -1.922 0 -0.331 0 104.8 -1.157 105.9 288.26 391.407 15.12 25.45 -0.252 0.029 0.195 -1.75 0.61
20050803 00:02 215 0.115184 -0.50452 120.29957 -2.36 0 -1.922 0 -0.331 0 104.8 -1.153 105.9 288.26 391.408 15.08 25.41 -0.36 0.037 0.202 -1.76 0.60
20050803 00:03 215 0.131851 -0.50442 120.29294 -2.36 0 -1.922 0 -0.331 0 104.8 -1.147 105.9 288.26 391.408 15.07 25.36 -0.396 0.007 0.188 -1.76 0.60
20050803 00:04 215 0.148517 -0.50431 120.28542 -2.356 0.027 -1.922 0 -0.331 0 104.8 -1.146 105.9 288.26 391.408 15.81 25.33 -0.504 0.044 0.237 -1.76 0.60
20050803 00:05 215 0.165184 -0.50418 120.27700 -2.349 0.047 -1.922 0 -0.331 0 104.8 -1.145 105.9 288.26 391.408 15.49 25.4 -0.18 0.029 0.136 -1.76 0.59
20050803 00:06 215 0.181851 -0.50404 120.26769 -2.36 0 -1.922 0 -0.331 0 104.8 -1.146 105.9 288.26 391.408 15.14 25.45 -0.036 0.015 0.079 -1.76 0.60
20050803 00:07 215 0.198517 -0.50389 120.25748 -2.36 0 -1.922 0 -0.331 0 104.8 -1.146 105.9 288.26 391.408 15.02 25.4 -0.108 0.044 0.155 -1.76 0.60
20050803 00:08 215 0.215184 -0.50372 120.24639 -2.36 0 -1.922 0 -0.364 0.099 104.8 -1.143 105.9 288.26 391.408 15.01 25.35 -0.072 0 0.161 -1.74 0.62
could anybody help me....or show me where is the mistake.
My propouse is average the 15th column each five times (each five minutes).
Thanks in advance and best regards for everybody.
I tried to do a script that average each five times, but i can't do it, and i've any mistake and i don't know where is.
#!/bin/gawk -f
BEGIN{FS = " ";c = 0;s = 0 ;};
{ s = s+$15; c = c++ };
if (c == 5){ a = s/5; print $1, $2, a};
the file is separated by spaces, and it is like:
20050803 00:00 215 0.081851 -0.50468 120.31015 -2.36 0 -1.922 0 -0.336 0.042 104.9 -1.16 105.9 288.26 391.407 15.49 25.4 -0.072 0 0.08^M -1.75 0.61
20050803 00:01 215 0.098517 -0.50461 120.30531 -2.36 0 -1.922 0 -0.331 0 104.8 -1.157 105.9 288.26 391.407 15.12 25.45 -0.252 0.029 0.195 -1.75 0.61
20050803 00:02 215 0.115184 -0.50452 120.29957 -2.36 0 -1.922 0 -0.331 0 104.8 -1.153 105.9 288.26 391.408 15.08 25.41 -0.36 0.037 0.202 -1.76 0.60
20050803 00:03 215 0.131851 -0.50442 120.29294 -2.36 0 -1.922 0 -0.331 0 104.8 -1.147 105.9 288.26 391.408 15.07 25.36 -0.396 0.007 0.188 -1.76 0.60
20050803 00:04 215 0.148517 -0.50431 120.28542 -2.356 0.027 -1.922 0 -0.331 0 104.8 -1.146 105.9 288.26 391.408 15.81 25.33 -0.504 0.044 0.237 -1.76 0.60
20050803 00:05 215 0.165184 -0.50418 120.27700 -2.349 0.047 -1.922 0 -0.331 0 104.8 -1.145 105.9 288.26 391.408 15.49 25.4 -0.18 0.029 0.136 -1.76 0.59
20050803 00:06 215 0.181851 -0.50404 120.26769 -2.36 0 -1.922 0 -0.331 0 104.8 -1.146 105.9 288.26 391.408 15.14 25.45 -0.036 0.015 0.079 -1.76 0.60
20050803 00:07 215 0.198517 -0.50389 120.25748 -2.36 0 -1.922 0 -0.331 0 104.8 -1.146 105.9 288.26 391.408 15.02 25.4 -0.108 0.044 0.155 -1.76 0.60
20050803 00:08 215 0.215184 -0.50372 120.24639 -2.36 0 -1.922 0 -0.364 0.099 104.8 -1.143 105.9 288.26 391.408 15.01 25.35 -0.072 0 0.161 -1.74 0.62
could anybody help me....or show me where is the mistake.
My propouse is average the 15th column each five times (each five minutes).
Thanks in advance and best regards for everybody.