#!/bin/sh ################################################################## ## File: tunes-credit-sum ## Date: November 17, 2014 ## Author: BRANT PUTTKAMMER ## Purpose: A script to calculate the total credit amount ## PROPERTY OF BRANT PUTTKAMMER, PLEASE CONTACT ME IF YOU HAVE QUESTIONS ## PLEASE USE CAUTION WHEN RUNNING THIS PROGRAM ON YOUR SYSTEM ################################################################## amount=0 tunes_count=0 tunes_amount=0 while read a; do string=$(echo "$a" | cut -d "|" -f1) amount=$(echo "$a" | cut -d "|" -f2) if [[ "$string" == *ITUNES* ]] || [[ "$string" == *AMZN* ]] || [[ "$string" == *AMAZON* ]]; then tunes_count=$(($tunes_count+1)) tunes_amount=$(($tunes_amount+$amount)) fi # FEE IN ULTRAFIS FORMAT, 400 = $4.00, USE CONVERSION CODE IN SUBROUTINE # echo $tunes_amount done < $PWD/SAVEDLISTS/AMAZONSEQ000 # GET DOLLAR VALUE FOR FORMATTING ON LAST LINE # echo $tunes_count # echo $tunes_amount echo $tunes_amount > $PWD/SAVEDLISTS/AMAZONSEQREFUND000 echo $tunes_count >> $PWD/SAVEDLISTS/AMAZONSEQREFUND000 # tunes_amount=$(($tunes_amount/100)) # echo $tunes_amount | awk '{printf "$%.2f\n",$1}' # GET DOLLAR VALUE FOR FORMATTING ON LAST LINE