Advertisement
lukasd

linux

Jan 17th, 2018
1,764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.61 KB | None | 0 0
  1. BEGIN{
  2. arr2[1]="Mon"
  3. arr2[2]="SKK"
  4. arr2[3]="Huragan"
  5. arr2[4]="Nowa"
  6. }
  7. {
  8.     if(($3=="Mon" && $10>$11) || ($7=="Mon" && $11>$10))
  9.         a++
  10.     if(($3=="SKK" && $10>$11) || ($7=="SKK" && $11>$10))
  11.         b++
  12.     if(($4=="Huragan" && $10>$11) || ($8=="Huragan" && $11>$10))
  13.         c++
  14.     if(($4=="Nowa" && $10>$11) || ($8=="Nowa" && $11>$10))
  15.         d++
  16. }
  17. END{
  18. arr[1]=a
  19. arr[2]=b
  20. arr[3]=c
  21. arr[4]=d
  22. for(i=1;i<5;i++){
  23. print arr2[i] arr[i]
  24. }
  25. for(i=1;i<5;i++){
  26. for(j=2;j<5;j++){
  27. if(arr[j-1]>arr[j]){
  28. e=arr[j-1]
  29. arr[j-1]=arr[j]
  30. arr[j]=e
  31. f=arr2[j-1]
  32. arr2[j-1]=arr2[j]
  33. arr2[j]=f
  34. }
  35. }
  36. }
  37. for(i=1;i<5;i++){
  38. print arr2[i] arr[i]
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement