Advertisement
Guest User

Untitled

a guest
Mar 16th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.64 KB | None | 0 0
  1. 1.
  2.  
  3. 2.
  4.  
  5. BEGIN { FS="[ :,]"
  6. max = -1
  7. i = 0 }{
  8. while(getline == 1){
  9. sum = $2 + $3
  10.   if(sum == max){
  11.    b=$1 $3 ":" $2
  12.    tab[i] = b
  13.    i = i+ 1
  14.   }
  15.   else if(sum > max ){
  16.    max = sum
  17.    b=$1 $2 ":" $3
  18.    i = 0
  19.    split("", tab)
  20.    tab[i] = b
  21.    i = i + 1
  22.  }
  23. }
  24. for( x in tab){
  25.    print tab[x]
  26. }}
  27. 3.
  28.  
  29. BEGIN { FS="[,]"
  30. sum = 0
  31. }
  32. {
  33. while(getline == 1){
  34.  sum = sum + $2
  35. }
  36.  print sum
  37. }
  38.  
  39. 4.
  40.  
  41. BEGIN { FS="[,]"
  42. max = 0
  43. count = 0
  44. sum = 0
  45. }{
  46. if(count == 4){
  47.     print max
  48.     count = 0
  49. }
  50. if(count < 4){
  51.     if( max < $2  ){
  52.         max = $2
  53.         details = $1 ", " $2
  54.     }
  55. count = count + 1
  56. }
  57. }
  58.  
  59. 5.
  60.  
  61. 6.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement