The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
divide a single file with different Weboffercodes into different files with each of o enigma_83 Shell Programming and Scripting 4 04-02-2008 08:27 AM
I can't divide properly in shell mikez104 UNIX for Dummies Questions & Answers 3 02-26-2008 05:20 PM
divide issue kotasateesh UNIX for Dummies Questions & Answers 1 02-13-2008 02:43 AM
divide with awk tontal Shell Programming and Scripting 1 10-09-2006 08:23 AM
divide field in two strings tonet Shell Programming and Scripting 2 07-17-2006 08:26 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-26-2006
wereyou wereyou is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 19
script needs to divide by 2

i need to divide this count by 2, what variable can i use in my script?

26 hcscprod_cpus_totals /2 = 13
13 hcncprod_cpus_totals /2= 6.5
541 ktazp_cpus_totals /2= 270.5
346 ktazd_cpus_totals /2=173
110 ktazi_cpus_totals /2=55
10 ktazq_cpus_totals /2=5
  #2 (permalink)  
Old 09-26-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,944
Code:
X=31
echo $((X/2))
  #3 (permalink)  
Old 09-26-2006
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
I always use bc for stuff like this:
Code:
# X=31
# echo $((X/2))
15
# echo "scale=1;${X}/2" | bc
15.5
Cheers
ZB
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0