I need some help to smooth some data with awk olny of column 4 and next. This is a data example:
Date;time;Time_ms;A;B;C;D
23.11.2012;15:03:00;41236627696;1;2;2;3
23.11.2012;15:04:00;41236628391;2;3;3;11
23.11.2012;15:06:00;41236629097;1;23;7;15
24.11.2012;15:07:00;41236627696;1;4;5;3
24.11.2012;15:08:00;41236628391;3;12;1;2
24.11.2012;15:09:00;41236629097;2;23;71;15;8
23.11.2012;15:10:00;41236627696;7;1;2;2;3
23.11.2012;15:11:00;41236628391;2;3;12;1;
23.11.2012;15:12:00;41236629097;22;2;7;15
The output should not modify Date;time;Time_ms and print the average of A with the A field of n row before and the A field of n row after. The same should be done for the B, C, D... column. For example if n=1 the second row will be:
23.11.2012;15:04:00;41236628391;(1+2+1)/3;(2+3+23)/3;(2+3+7)/3;(3+11+15)/3
Maybe something like this can be a startpoint
BEGIN { WIDTH=3 }
{ DATA[(++N)%WIDTH]=$0 }
(N>=WIDTH) {
V=0
for(X=(N+1); X<=(N+WIDTH); X++)
V+=DATA[X%WIDTH];
print V/WIDTH;
}