Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Math with 2 decimal places
 Linux - Newbie This Linux forum is for members that are new to Linux. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

 09-14-2006, 11:49 PM #1 newbie_adm Member   Registered: Jun 2006 Posts: 40 Rep: 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
 09-15-2006, 12:14 AM #2 w3bd3vil Senior Member   Registered: Jun 2006 Location: Hyderabad, India Distribution: Fedora Posts: 1,189 Rep: if you want variables in points then define them as float. float \$variable

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Four General 5 04-19-2006 08:02 PM linuxmandrake Programming 2 03-17-2006 03:31 PM nadroj Programming 6 07-12-2005 11:03 AM maldini1010 Programming 6 02-01-2005 04:03 PM Strus Programming 3 12-17-2004 08:42 PM

LinuxQuestions.org

All times are GMT -5. The time now is 12:57 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -