cat $finqual/cashfin | sed 's/^Grand Total/x x x Grand total/g' | cut -d" " -f4- |
awk '/STARTED ON UNIX/ { startHH = substr($0,1,2); startMI = substr($0,4,2) }
/FINISHED ON UNIX/ { endHH = substr($0,1,2); endMI = substr($0,4,2) }
/CITRPPB_THREAD.._rep01/ { threadCount++ }
/Grand Total/ { if ( totalCount == 0 ) { totalCount = substr($0,21,5); totalAmount = substr($0,28,11) } }
END {
totalCountRemaining = totalCount
if ( totalCountRemaining / 1000 >= 1 )
{
wholenumber = sprintf("%i",totalCountRemaining / 1000)
totalCountFormatted = sprintf("%i,",wholenumber)
totalCountRemaining -= ( wholenumber * 1000 )
}
totalCountFormatted = sprintf("%s%03i",totalCountFormatted,totalCountRemaining)
totalAmountRemaining = totalAmount
if ( totalAmountRemaining / 1000000 >= 1 )
{
wholenumber = sprintf("%i",totalAmountRemaining / 1000000)
totalAmountFormatted = sprintf("%i,",wholenumber)
totalAmountRemaining -= ( wholenumber * 1000000 )
}
if ( totalAmountRemaining / 1000 >= 1 )
{
wholenumber = sprintf("%i",totalAmountRemaining / 1000)
totalAmountFormatted = sprintf("%s%03i,",totalAmountFormatted,wholenumber)
totalAmountRemaining -= ( wholenumber * 1000 )
}
totalAmountFormatted = sprintf("$ %s%03.2f",totalAmountFormatted,totalAmountRemaining)
startAP = endAP = "am"
if ( startHH == 0 ) { startHH = 12 }
if ( startHH > 12 ) { startHH -= 12; startAP = "pm" }
if ( endHH == 0 ) { endHH = 12 }
if ( endHH > 12 ) { endHH -= 12; endAP = "pm" }
startTime = sprintf("%i:%02i %s",startHH,startMI,startAP)
endTime = sprintf("%i:%02i %s",endHH,endMI,endAP)
printf("<P><B>run.cash</B> started at %s and completed at %s.<BR>",startTime,endTime)
printf("(%i threads)<BR>",threadCount)
printf("Total payments: <B>%s</B> Amount: <B>%s</B>",totalCountFormatted,totalAmountFormatted)
}'