File: moyx.awk

package info (click to toggle)
getdp 3.0.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,856 kB
  • sloc: cpp: 63,020; fortran: 13,955; yacc: 9,350; f90: 1,640; lex: 799; makefile: 55; ansic: 34; awk: 33; sh: 23
file content (21 lines) | stat: -rw-r--r-- 405 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# When cut on a plane, this little program allows to calculate the mean in one
# direction of the cut. If a cut of (4,3), moyx.awk gives 5 values with the 
# mean of the four associated values.


BEGIN { y = 0; sum = 0;}

{if ($1==15){
if(y!=$4) {
  printf("%12.5e %12.5e \n",y,sum/cont)
  y = $4
  sum = $9
  cont=1
  }
  else {
    sum+=$9
    cont++
  }
}
}
END {printf("%12.5e %12.5e \n",y,sum/cont)}