Advertisement
metalx1000

ENFD Stat output from CAD PDF

Jan 8th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.24 KB | None | 0 0
  1. #!/bin/bash
  2. #converts Printed PDF from CAD to text
  3. #then pulls stats from data
  4. #Created By Kris Occhipinti
  5. #January 8th, 2014
  6. #GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
  7. #PDF can be created with:
  8. #http://download.cnet.com/Print-to-PDF/3000-10743_4-75945959.html
  9.  
  10. clear
  11. echo -n "Calculating Data.."
  12.  
  13. pdf="$1"
  14. output="$(echo "$1"|cut -d\. -f1).txt"
  15. tmp="en.tmp"
  16.  
  17. pdftotext "$pdf" "$tmp"
  18. echo -n "."
  19. sed -i ':a;N;$!ba;s/\n/|/g' "$tmp"
  20. echo -n "."
  21. sed -i 's/||/|/g' $tmp
  22. echo -n "."
  23. sed -i 's/CC|EN/\nCC|EN/g' "$tmp"
  24. echo -n "."
  25. grep "CC|EN" "$tmp" > "$output"
  26. echo -n "."
  27. rm "$tmp"
  28.  
  29. total="$(cat "$output"|cut -d\| -f3|grep CC|sort -u|wc -l)"
  30. for i in {1..12}
  31. do
  32.     echo -n "."
  33.     x=$(printf "%02d" $i) #adds a zero for date is value is 1 digit
  34.     month[$i]="$(cat "$output"|cut -d\| -f3,4|grep CC|grep "/$x/"|sort -u|wc -l)"
  35. done
  36.  
  37. clear
  38.  
  39. echo "Call Estimates"
  40. echo "--------------"
  41. echo "Jan: ${month[1]}"
  42. echo "Feb: ${month[2]}"
  43. echo "Mar: ${month[3]}"
  44. echo "Apr: ${month[4]}"
  45. echo "May: ${month[5]}"
  46. echo "Jun: ${month[6]}"
  47. echo "Jul: ${month[7]}"
  48. echo "Aug: ${month[8]}"
  49. echo "Sep: ${month[9]}"
  50. echo "Oct: ${month[10]}"
  51. echo "Nov: ${month[11]}"
  52. echo "Dec: ${month[12]}"
  53.  
  54. echo ""
  55. echo "Estimated Total: $total"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement