Guest User

Untitled

a guest
Jun 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. export LC_CTYPE=C
  4.  
  5. input_file=$1
  6. output_path=$2
  7.  
  8. views=($(awk 'BEGIN { ORS = "\n" } $9 == 200 {print $1":"$10}' ${input_file}))
  9.  
  10. unique_views=($(echo "${views[*]}" | awk -F : '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}'))
  11.  
  12. IFS=$'\n' sorted=($(sort -k 2,2 <<< "${unique_views[*]}"))
  13.  
  14. printf "%s\n" "${sorted[@]}" > $2/sorted_unique_views
  15. tail -10 $2/sorted_views
  16.  
  17. broken=($(awk 'BEGIN { ORS = "\n" } $9 != 200 {print $7}' ${input_file}))
  18. #broken_uniq=$(printf "%s\n" "${broken[@]}" | tr '\r' '\n' | sort | uniq)
  19. printf "%s\n" "${broken[@]}" | sort | uniq > $2/broken_relocated
  20.  
  21. echo -e "\n\n################Broken or relocated"
  22. tail -10 $2/broken_relocated
Add Comment
Please, Sign In to add comment