Hello all,
Code below:
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?
try df -h it will show gb if you have gb
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 ...]
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
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)
} '
jyoung
September 17, 2007, 2:31pm
6
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
#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