All pastes #408 Raw Edit

CDRCSV Total Shell Script

public php v1 · immutable
#408 ·published 2004-08-02 19:42 UTC
rendered paste body
; CDR_CSV Total Script; takes in 2 arguments the file to parse and what pattern to grep for; use ' ' on larger grep matches #!/bin/bashtotalamt=0for amnt in ` cat $1 | grep $2 | cut -d ',' -f13`dototalamt=`expr $totalamt + $amnt`donetotalamt=`expr $totalamt / 60`totalhrs=`expr $totalamt / 60`totalmins=`expr $totalamt % 60`echo "total: $totalhrs:$totalmins"echo "Debug - Total Mins - $totalamt"