Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #converts Printed PDF from CAD to text
- #then pulls stats from data
- #Created By Kris Occhipinti
- #January 8th, 2014
- #GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
- #PDF can be created with:
- #http://download.cnet.com/Print-to-PDF/3000-10743_4-75945959.html
- clear
- echo -n "Calculating Data.."
- pdf="$1"
- output="$(echo "$1"|cut -d\. -f1).txt"
- tmp="en.tmp"
- pdftotext "$pdf" "$tmp"
- echo -n "."
- sed -i ':a;N;$!ba;s/\n/|/g' "$tmp"
- echo -n "."
- sed -i 's/||/|/g' $tmp
- echo -n "."
- sed -i 's/CC|EN/\nCC|EN/g' "$tmp"
- echo -n "."
- grep "CC|EN" "$tmp" > "$output"
- echo -n "."
- rm "$tmp"
- total="$(cat "$output"|cut -d\| -f3|grep CC|sort -u|wc -l)"
- for i in {1..12}
- do
- echo -n "."
- x=$(printf "%02d" $i) #adds a zero for date is value is 1 digit
- month[$i]="$(cat "$output"|cut -d\| -f3,4|grep CC|grep "/$x/"|sort -u|wc -l)"
- done
- clear
- echo "Call Estimates"
- echo "--------------"
- echo "Jan: ${month[1]}"
- echo "Feb: ${month[2]}"
- echo "Mar: ${month[3]}"
- echo "Apr: ${month[4]}"
- echo "May: ${month[5]}"
- echo "Jun: ${month[6]}"
- echo "Jul: ${month[7]}"
- echo "Aug: ${month[8]}"
- echo "Sep: ${month[9]}"
- echo "Oct: ${month[10]}"
- echo "Nov: ${month[11]}"
- echo "Dec: ${month[12]}"
- echo ""
- echo "Estimated Total: $total"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement