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
Displaying Output in Columns jjamd64 Shell Programming and Scripting 1 04-25-2008 07:46 AM
displaying $ in data ammu UNIX for Dummies Questions & Answers 2 02-19-2008 03:00 PM
displaying output in a table. sanchopansa Shell Programming and Scripting 6 10-06-2006 01:22 PM
displaying with ls vivekshankar UNIX for Dummies Questions & Answers 2 05-23-2005 04:46 PM
Displaying Script command with output JeDi Shell Programming and Scripting 5 04-30-2004 12:09 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-2007
LinuxRacr LinuxRacr is offline
Registered User
  
 

Join Date: Aug 2007
Location: DFW, Texas
Posts: 60
Displaying output from df -k in GB instead of KB

Hello all,

Code below:


Code:
echo "Oracle Filesystems"
echo "------------------"
echo
for j in `df -l -k |grep total|grep ora|grep -v storage|grep -v vg00|awk '{print $1}'`
do
echo $j is `df -l -k $j |grep total|grep ora|grep -v storage|grep -v vg00|awk -F":" '{print $2}'|awk '{print $1}'` KB
done
echo

Here is the output:

Oracle Filesystems
------------------

/ora_1 is 369437312 KB
/ora_2 is 369438640 KB
/ora_3 is 366768144 KB


I want to dsiplay the output of df -k in GB instead of KB. How would I do that?
  #2 (permalink)  
Old 09-13-2007
MizzGail's Avatar
MizzGail MizzGail is offline
Registered User
  
 

Join Date: Sep 2001
Location: Syracuse, NY
Posts: 164
try df -h it will show gb if you have gb
  #3 (permalink)  
Old 09-13-2007
LinuxRacr LinuxRacr is offline
Registered User
  
 

Join Date: Aug 2007
Location: DFW, Texas
Posts: 60
Forgot to mention....

This is for HP-UX

# df -h
df: illegal option -- h
usage : df [-F FStype] [-V] [-egiklnvfb] [-t|-P] [-o specific_options]
[special | directory ...]
  #4 (permalink)  
Old 09-14-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Gb

If you can extract the Kb figure into a variable you can turn it into Mb with bc
if $size contains your Kb figure

$(echo "scale=2;${size} / 1000000" | bc)

will return a Gb figure - the 'scale=2' set the No of decimal places
  #5 (permalink)  
Old 09-17-2007
LinuxRacr LinuxRacr is offline
Registered User
  
 

Join Date: Aug 2007
Location: DFW, Texas
Posts: 60
Found another way too using AWK:


Code:
df -k -l | awk '
BEGIN {print "Oracle Filesystems\n------------------\n"}
END {print ""}
/ora/ && !/vg00/ && !/storage/ {
printf ("%-20s is %5.1f Gb\n",$1,$(NF-3)/1024/1024)
} '

  #6 (permalink)  
Old 09-17-2007
jyoung jyoung is offline
Registered User
  
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 228
have you tried df -g ? That is on an AIX machine. I found it by doing a 'man df'.
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 01:16 PM.


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