Guest User

Untitled

a guest
Dec 10th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. E12 E 2 7.75 11.97
  2. E20 E 4 7.85 8.32
  3. E17 E 2 7.75 19.25
  4. A15 A 3 7.85 4.52
  5. A29 A 2 7.75 14.26
  6. A14 A 3 7.85 13.29
  7. C14 C 6 8.05 48.23
  8. C12 C 6 8.05 29.42
  9. C42 C 2 7.75 13.42
  10.  
  11. awk '
  12. NR > 2 {TOT[$2,$4] += $5 # sum values into array indexed by both columns'' contents
  13. CNT[$2,$4]++ # count occurrences
  14. }
  15. END {for (t in TOT) {split (t, C, SUBSEP) # split indices into colonies and pH''es
  16. print C[1], C[2], TOT[t]/CNT[t] # print colony, pH, average
  17. }
  18. }
  19. ' OFS="t" file | sort # define output filed sparator and input file
  20. A 7.75 14.26
  21. A 7.85 8.905
  22. C 7.75 13.42
  23. C 8.05 38.825
  24. E 7.75 15.61
  25. E 7.85 8.32
Add Comment
Please, Sign In to add comment