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
Round with awk AnnaLynn Shell Programming and Scripting 1 05-06-2008 03:55 PM
Srry Im a bit new round here..... BigDaddyDirt UNIX for Dummies Questions & Answers 3 03-17-2008 03:54 PM
round in KSH here2learn Shell Programming and Scripting 6 07-18-2006 01:18 PM
how to round a value kotasateesh UNIX for Dummies Questions & Answers 2 02-08-2006 05:38 PM
Round off decimal number to 2 decimal places? Vozx Shell Programming and Scripting 1 12-07-2005 10:53 PM

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-13-2006
achieve achieve is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 6
round a number

In a shell script - How do I round a decimal number (contained in a variable) to the nearest whole number?
  #2 (permalink)  
Old 09-13-2006
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Try...
Code:
 echo $var|awk '{print int($1+0.5)}'

  #3 (permalink)  
Old 09-14-2006
achieve achieve is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 6
thank you!
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 07:34 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