Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.38 KB | None | 0 0
  1. function storemaxes() {
  2.    for (i in tmpcnt) {
  3.       if (tmpcnt[i] > maxes[i])
  4.          maxes[i] = tmpcnt[i]
  5.    }
  6.    delete tmpcnt
  7. }
  8.  
  9.  
  10. { period = substr($0,1,9) }
  11.  
  12. (period != prevperiod) {
  13.    storemaxes()
  14. }
  15.  
  16. {
  17.    tmpcnt[$NF]++
  18.    prevperiod = period
  19. }
  20.  
  21.  
  22. END {
  23.    if (period == prevperiod)
  24.       storemaxes()
  25.  
  26.    for ( i in maxes)
  27.       print i, maxes[i]
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement