Skip to content

Instantly share code, notes, and snippets.

@groundnuty
Created September 7, 2018 10:41
Show Gist options
  • Save groundnuty/c6d61bb41bb4cc1946e8bf57559547d3 to your computer and use it in GitHub Desktop.
Save groundnuty/c6d61bb41bb4cc1946e8bf57559547d3 to your computer and use it in GitHub Desktop.
premium mobile analyse

Compare data prices

pdftotext -layout -enc ASCII7 FV-017240-18-09-1-022909-biling.pdf - | sed -n -e '/Data poczenia/,$p' | sed -n -e '2,$p' | grep -v " 0,00 " | sed 's/[[:space:]]\{15\}/\tX\t/g' | sed   -e '/.*(Rozliczenie pakietu:$/{n;d}' | sed 's/[[:space:]][[:space:]]\+/\t/g' | grep "Transmisja danych" | sed 's/\o14//g'  |  cut -d $'\t' -f 4,5 | while read size price ; do msize=$(echo "$size/1024/1024" | bc ) ; mprice=$( echo "$msize*0.02" | bc) ; echo "$size [B], $price [zl] | $msize [MB] $mprice [zl] | rate 0.02/MB [Germany]" ; done  | column -t

Sum up all the costs

pdftotext -layout -enc ASCII7 FV-017240-18-09-1-022909-biling.pdf - | sed -n -e '/Data poczenia/,$p' | sed -n -e '2,$p' | grep -v " 0,00 " | sed 's/[[:space:]]\{15\}/\tX\t/g' | sed   -e '/.*(Rozliczenie pakietu:$/{n;d}' | sed 's/[[:space:]][[:space:]]\+/\t/g' | cut -d $'\t' -f 5 | sed -n -e '0,/Lcznie/p' | sed \$d | tr ',' . | paste -s -d+ - | bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment