Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change kb to gb in script 1

Status
Not open for further replies.

630111

MIS
Oct 30, 2001
127
US
The script I'm working on produces values in kb (such as 230802698 kb). How do I convert this value so that it's expressed in gb?

Thanks, in advance!
630111
 
Try dividing by 1048576 which is 220

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks TomThumbKP, that's part of the answer I needed.
Because of you, I don't have to divide my kb by 1024 to get mb then divide again by 1024 to get gb.

Here's where I am:

#!/bin/sh
KBVALUE=980642650
GBVALUE=`expr $KBVALUE / 1048576`
echo "$KBVALUE kb is $GBVALUE gb"

Thanks again!
630111


 
To have this : 220
type this: [ignore]220[/ignore]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

never heard about [bd]c ? try:
echo "2^9999"|bc
man bc, dc



don't forget, RTFMP :) guggach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top