Displaying output from df -k in GB instead of KB


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Displaying output from df -k in GB instead of KB
# 1  
Old 09-13-2007
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  
Old 09-13-2007
try df -h it will show gb if you have gb
# 3  
Old 09-13-2007
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  
Old 09-14-2007
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  
Old 09-17-2007
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  
Old 09-17-2007
have you tried df -g ? That is on an AIX machine. I found it by doing a 'man df'.
# 7  
Old 09-19-2007
Quote:
Originally Posted by jyoung
have you tried df -g ? That is on an AIX machine. I found it by doing a 'man df'.

df -g in HP-UX:

-g Report the entire structure described in
Code:
#df -g /var/adm/sw

/var/adm/sw            (/dev/vg00/lvol8       ) :
           8192 file system block size            1024 fragment size
        3145728 total blocks                   1881118 total free blocks
        1763583 allocated free blocks           501372 total i-nodes
         470276 total free i-nodes              470276 allocated free i-nodes
     1073741832 file system id                    vxfs file system type
              0 flags                             255 file system name length

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

PS output is not displaying full process running

I have 4 HPUX 11.31 servers with the same Quality Pack bundles. "AS FAR AS I CAN TELL" no system files have been modified. /usr/bin/ps is the same date size and creation date terminfo file (x-->xterm) is the same date size and creation date shell (ksh) is the same date size and creation date ... (4 Replies)
Discussion started by: mrmurdock
4 Replies

2. Shell Programming and Scripting

Python Output Displaying Horizontal

I feel bad for posting so much lately. I've just been working on a project for fun to force myself to learn Python better. Recently I decided to incorporate this ping.py script on github found here. I'm not going to bore you with all the changes I made, but the problem now lies in this function... (8 Replies)
Discussion started by: Azrael
8 Replies

3. Shell Programming and Scripting

Displaying log file pattern output in tabular form output

Hi All, I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form 1). Intercomponents Checking Passed: All Server are passed. ====================================================================== 2). OS version Checking... (9 Replies)
Discussion started by: Optimus81
9 Replies

4. Shell Programming and Scripting

Displaying output in the tabular format

Hi I want to display the following input data into the tabular format as shown in the output. Input.txt: Following jobs are in pending state for more than 10 minutes: JOB_ID JOB_SUBMIT_ID MAHAR 784308 PUNJA 109367 Following jobs are running for longer time: JOB_ID... (1 Reply)
Discussion started by: dats
1 Replies

5. Shell Programming and Scripting

Displaying the output in the tabular Format

Hi, I have a file which contains the data in the below format and need to develop a script which will give the output in the tabular format. Could you please advice me. Folder: Workflow: version . Workflow run status: Workflow run error code: Schedule time: Workflow run type: ... (2 Replies)
Discussion started by: kandi.reddy
2 Replies

6. Shell Programming and Scripting

Output Parameter value not displaying

Hi all, Below is my shell script that calls a stored procedure(with output parameter) I have tried executing this script but it doesn't display the output parameter value. Can anyone help me ? :( #!/bin/bash ###############################################################################... (7 Replies)
Discussion started by: saviochacko
7 Replies

7. Shell Programming and Scripting

script not displaying output correctly

Hi, I am having an issue with my script, ofcourse... I am trying to run commands against a remote server, I am pulling the hostnames or IPs from a file list, then looping thru and running the date cmd. I will be running different cmds just trying to get it working first. The ouput isn't... (2 Replies)
Discussion started by: dfezz1
2 Replies

8. Shell Programming and Scripting

Displaying Output in Columns

I'm writing a script to analyze the logs of an smtp relay machine and I'd like the final output to be displayed in columns showing results from the previous day, week, month, and 45 days. The problem I'm running into is that I can't figure out how to display the columns neatly so there is no... (1 Reply)
Discussion started by: jjamd64
1 Replies

9. Shell Programming and Scripting

displaying output in a table.

Hello, I've just finished my first script (about displaying open ports on the computer and who opened them) and everything is fine with it but I want to style it a little bit just for the sake of learning how to do this. What I want to do is make the display like the one of ps, for example,... (6 Replies)
Discussion started by: sanchopansa
6 Replies

10. Shell Programming and Scripting

Displaying Script command with output

How do you display the script command for a particular output result? Is there an editor that will allow for an echo or sysout of the script that causes an output result? We have hundreds of lines in the script, which we would like to see along with the output, and don't want to have to put in... (5 Replies)
Discussion started by: JeDi
5 Replies
Login or Register to Ask a Question