Math with 2 decimal places
Hi. I'm doing a script that will calculate for total number of minutes or average min per call in asterisk. Me problem is that, when I do the math, It never resulted with decimal numbers which I really need. Here is an example of what I'm calculating
70/60/5
where 70 is the total usage of call in seconds.
where 60 is equivqlent to 1 min.(i have to divide 70 by 60. answer would be 1.16
where 5 is the total successful calls. I have to divide that total minutes(1.16)to 5 calls
that would 0.233
The script is prompting just 0.
I need the 0.233
How can I do this in my script?
Here is my example script.
TMECNSUMED=`cat master.txt | sed 's/ /\t/g' | grep "ANSWERED" | awk '{print $2}'`
seconcdr=0 #controls for the i
b=0 #Variable counter for row
for i in $TMECNSUMED
do
(( seconcdr = $i + $seconcdr ))
(( b = b + 1 ))
done
(( seconcdr= ($seconcdr/60)/$b))
Pleasehelp me on this thanks
Best Regards,
newbie_adm
|