<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Displaying output from df -k in GB instead of KB in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070335#M94828</link>
    <description>&lt;!--!*#--&gt;Made another variation of Hein van den Heuvel's  grand total script:&lt;BR /&gt;&lt;BR /&gt;df -k -l | awk '&lt;BR /&gt; BEGIN {print "\nFlat Files\n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\n------------------\nTotal %3.3f Tb\n\n", t/1024/1024/1024) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt;  /total/ &amp;amp;&amp;amp; !/ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/ebr/ {&lt;BR /&gt; t+=$(NF-3);&lt;BR /&gt; printf ("%-35s is %5.3f Gb\n",$1,$(NF-3)/1024/1024) &amp;gt;&amp;gt; "sizes.report"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt; df -k -l | awk '&lt;BR /&gt; BEGIN {print "\nOracle Filesystems\n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\n------------------\nTotal %3.3f Tb\n\n", t/1024/1024/1024) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; /total/ &amp;amp;&amp;amp; /ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/storage/ {&lt;BR /&gt; t+=$(NF-3);&lt;BR /&gt; printf ("%-35s is %5.3f Gb\n",$1,$(NF-3)/1024/1024) &amp;gt;&amp;gt; "sizes.report"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt; df -k -l | awk '&lt;BR /&gt; BEGIN {print "\nEBR Filesystems\n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\n------------------\nTotal %3.3f Tb\n\n", t/1024/1024/1024) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; /total/ &amp;amp;&amp;amp; /ebr/ &amp;amp;&amp;amp; !/vg00/ {&lt;BR /&gt; t+=$(NF-3);&lt;BR /&gt; printf ("%-35s is %5.3f Gb\n",$1,$(NF-3)/1024/1024) &amp;gt;&amp;gt; "sizes.report"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt;The code above creates sizes.report&lt;BR /&gt;&lt;BR /&gt;sizes.report output:&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;Flat Files&lt;BR /&gt;------------------&lt;BR /&gt;/usr/local                          is 2.291 Gb&lt;BR /&gt;/usr/local2                        is 0.118 Gb&lt;BR /&gt;/var/mqm                            is 9.170 Gb&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;Total 0.011 Tb&lt;BR /&gt;&lt;BR /&gt;Oracle Filesystems&lt;BR /&gt;------------------&lt;BR /&gt;/usr/local/oracle/10.2.0            is 7.795 Gb&lt;BR /&gt;/usr/local/oracle/9.2.0             is 5.686 Gb&lt;BR /&gt;/usr/local/oracle                   is 5.708 Gb&lt;BR /&gt;/usr/local/oracle2                  is 1.907 Gb&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;Total 0.020 Tb&lt;BR /&gt;&lt;BR /&gt;EBR Filesystems&lt;BR /&gt;------------------&lt;BR /&gt;/opt/app/ebr1           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr2           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr3           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr4           is 2031.505 Gb&lt;BR /&gt;/opt/app/ebr5           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr6           is 2029.520 Gb&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;Total 11.894 Tb&lt;BR /&gt;&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;end sizes.report output&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The code below processes the file, and outputs a total of the totals:&lt;BR /&gt;&lt;BR /&gt;cat sizes.report | awk '&lt;BR /&gt; BEGIN {print "\nTotal Of All \n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\nTotal %3.3f Tb\n\n", t) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; /Total/ {&lt;BR /&gt; t+=$(NF-1);&lt;BR /&gt; #printf ("%5.3f Tb\n",$(NF-1) &amp;gt;&amp;gt; "sizes.report")&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt;The result is appended to the end of the file sizes.report:&lt;BR /&gt;&lt;BR /&gt;Total Of All&lt;BR /&gt;------------------&lt;BR /&gt;&lt;BR /&gt;Total 11.925 Tb&lt;BR /&gt;</description>
    <pubDate>Fri, 14 Sep 2007 21:11:44 GMT</pubDate>
    <dc:creator>Patrick Ware_1</dc:creator>
    <dc:date>2007-09-14T21:11:44Z</dc:date>
    <item>
      <title>Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070317#M94810</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;Code below:&lt;BR /&gt;&lt;BR /&gt;[CODE]&lt;BR /&gt;&lt;BR /&gt;echo "Oracle Filesystems"&lt;BR /&gt;echo "------------------"&lt;BR /&gt;echo&lt;BR /&gt;for j in `df -l -k |grep total|grep ora|grep -v storage|grep -v vg00|awk '{print $1}'`&lt;BR /&gt;do&lt;BR /&gt;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&lt;BR /&gt;done&lt;BR /&gt;echo&lt;BR /&gt;&lt;BR /&gt;[/CODE]&lt;BR /&gt;&lt;BR /&gt;Here is the output:&lt;BR /&gt;&lt;BR /&gt;Oracle Filesystems&lt;BR /&gt;------------------&lt;BR /&gt;&lt;BR /&gt;/ora_1 is 369437312 KB&lt;BR /&gt;/ora_2 is 369438640 KB&lt;BR /&gt;/ora_3 is 366768144 KB&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want to dsiplay the output of df -k in GB instead of KB.  How would I do that?</description>
      <pubDate>Thu, 13 Sep 2007 13:39:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070317#M94810</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-13T13:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070318#M94811</link>
      <description>Hi Patrick:&lt;BR /&gt;&lt;BR /&gt;Bill Hassell has a 'bdf' script which allows output in MB or GB and more importantly handles the case of multi-line output for any filesystem.&lt;BR /&gt;&lt;BR /&gt;Why re-invent the wheel, when Bill offers his documented script here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You can also select only the filesystems you want reported when you run it, just like the standard 'bdf'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 13 Sep 2007 13:45:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070318#M94811</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-13T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070319#M94812</link>
      <description>Bill Hassell has enhanced his "bdfmegs" script to display GB output.  See:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1048509" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1048509&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I would think you could use that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 13 Sep 2007 13:46:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070319#M94812</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2007-09-13T13:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070320#M94813</link>
      <description>James is too quick.  I would also reference the Bill H. script.  Works great, forum approved :)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 13:46:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070320#M94813</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2007-09-13T13:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070321#M94814</link>
      <description>And here's the latest version of "bdfmegs":&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 13 Sep 2007 13:47:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070321#M94814</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2007-09-13T13:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070322#M94815</link>
      <description>Patrick, you have the 'right solution' already. &lt;BR /&gt;Good. &lt;BR /&gt;&lt;BR /&gt;But indulge me, and take an other look at the original script.&lt;BR /&gt;It runs 6 processes on the first real line,&lt;BR /&gt;and then N times 6 more for each oracle mount point, for a grand total of 24 in the example, all this for data which is right there for the grab / filter all along.&lt;BR /&gt;&lt;BR /&gt;Stuff like that makes performance folks cry, cringe, or snicker depending on their mood.&lt;BR /&gt;&lt;BR /&gt;Check out this 'one liner'.&lt;BR /&gt;It does the same job with 2 commands:&lt;BR /&gt;&lt;BR /&gt;df -k -l | awk 'BEGIN{print "Oracle Filesystems\n------------------\n"} END{print ""} /ora/&amp;amp;&amp;amp;!/vg00/{print $1,"is",$5,"Kb"}' &lt;BR /&gt;&lt;BR /&gt;Now change the main print to printf and pass $5/1024 instead of $5 as found and voila!&lt;BR /&gt;&lt;BR /&gt;In script form...&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;df -k -l | awk '&lt;BR /&gt;BEGIN {print "Oracle Filesystems\n------------------\n"}&lt;BR /&gt;END {print ""}&lt;BR /&gt;/ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/storage/ {&lt;BR /&gt;   printf ("%-20s is %5.1f Gb\n",$1,$5/1024)&lt;BR /&gt;} '&lt;BR /&gt;------------------&lt;BR /&gt;&lt;BR /&gt;Of course it matters little for a task like posted, but it's the principle of things.&lt;BR /&gt;&lt;BR /&gt;Also, I'd like to think that if the task had been solved along the lines above, then any Unix hacker in your environment, and many a Windoze person, could have handled the improvement request.&lt;BR /&gt;&lt;BR /&gt;Hope this helps someone some day,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 15:24:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070322#M94815</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-13T15:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070323#M94816</link>
      <description>For your example:&lt;BR /&gt; &lt;BR /&gt;&amp;gt; /ora_1 is 369437312 KB&lt;BR /&gt;&amp;gt; /ora_2 is 369438640 KB&lt;BR /&gt;&amp;gt; /ora_3 is 366768144 KB&lt;BR /&gt; &lt;BR /&gt;You can get not only the selected filesystems but also a sum total for them from bdfmegs:&lt;BR /&gt; &lt;BR /&gt;echo "Oracle Filesystems"&lt;BR /&gt;echo "------------------"&lt;BR /&gt;bdfmegs -g -s /ora_*&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 21:06:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070323#M94816</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-09-13T21:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070324#M94817</link>
      <description>All who have shown me bdfmegs, thank you!  I like the way it works.&lt;BR /&gt; &lt;BR /&gt;Hein van den Heuvel,&lt;BR /&gt;&lt;BR /&gt;I like your method.  Thank you too!&lt;BR /&gt;&lt;BR /&gt;One thing I noticed is that I had to make the following line:&lt;BR /&gt;&lt;BR /&gt; printf ("%-20s is %5.1f Gb\n",$1,$5/1024) &lt;BR /&gt;&lt;BR /&gt;Look like this:&lt;BR /&gt;  printf ("%-20s is %5.1f Gb\n",$1,$5/1024/1024)&lt;BR /&gt;&lt;BR /&gt;To get true GB readings.</description>
      <pubDate>Thu, 13 Sep 2007 22:12:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070324#M94817</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-13T22:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070325#M94818</link>
      <description>Also, you seem to be on a roll.  How would one make this one more efficient:&lt;BR /&gt;&lt;BR /&gt;df -l -k |grep total|grep -v ora|grep -v ebr|grep -v vg00|awk -F":" '{print $2}'|awk '{print $1}' &amp;gt; sizes.flatfiles&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Sep 2007 23:04:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070325#M94818</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-13T23:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070326#M94819</link>
      <description>I figured it out:&lt;BR /&gt;&lt;BR /&gt;df -k -l | awk '&lt;BR /&gt;  /total/ &amp;amp;&amp;amp; !/ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/ebr/ {&lt;BR /&gt; printf ("%5f\n",$5) &amp;gt;&amp;gt; "sizes.flatfiles"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Too bad i can't give myself points!</description>
      <pubDate>Thu, 13 Sep 2007 23:28:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070326#M94819</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-13T23:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070327#M94820</link>
      <description>Good catch, and good fix.&lt;BR /&gt;My script reported Mb, not Gb.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; I figured it out: &lt;BR /&gt;&lt;BR /&gt;Excellent.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; Too bad i can't give myself points!&lt;BR /&gt;&lt;BR /&gt;Just find grab a query I created and say hello! Nah...&lt;BR /&gt;&lt;BR /&gt;Seriously, I am very pleased you considered the alternative and checked out how it worked. Good work! &lt;BR /&gt;I had wondered whether it would be a total waste of time to add my reply, but couldn't help myself. No I'm redeemed :-).&lt;BR /&gt;&lt;BR /&gt;As reward I'll show how to do grand total. :-).&lt;BR /&gt;I added a variable t (total) which accumulated all KB values in the main code.&lt;BR /&gt;Then at the end, where previously is printed just an empty line, it now prints that total.. divived by 1M.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;bdf -k -l | awk '&lt;BR /&gt;BEGIN {print "Oracle Filesystems\n------------------\n"}&lt;BR /&gt;END {printf ("\nTotal %3.1fGb\n\n", t/1024/1024)}&lt;BR /&gt;/ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/storage/ {&lt;BR /&gt;   t+=$5;&lt;BR /&gt;   printf ("%-20s is %5.1f Gb\n",$1,$5/1024/1024)&lt;BR /&gt;} '&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Sep 2007 00:49:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070327#M94820</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-09-14T00:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070328#M94821</link>
      <description>&amp;gt;How would one make this one more efficient:&lt;BR /&gt;df -l -k |grep total|grep -v ora|grep -v ebr|grep -v vg00|awk &lt;BR /&gt;&lt;BR /&gt;If you want to do a part way job, you can combine the grep -v:&lt;BR /&gt;df -l -k |grep total|grep -v -e ora -e ebr -e vg00 | awk&lt;BR /&gt;&lt;BR /&gt;You may have to be careful if your strings are found as substrings.  You can add -w to fix that.</description>
      <pubDate>Fri, 14 Sep 2007 00:55:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070328#M94821</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-14T00:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070329#M94822</link>
      <description>Looks like I ran into a little issue:&lt;BR /&gt;&lt;BR /&gt;# df -l -k /ora05 | grep total&lt;BR /&gt;/ora05            (/dev/vg05/lvol1    ) : 368868648 total allocated Kb&lt;BR /&gt;&lt;BR /&gt;# df -l -k /ora06 | grep total&lt;BR /&gt;/ora06            (/dev/vg06/lvol1) : 366767600 total allocated Kb&lt;BR /&gt;&lt;BR /&gt;If you look at the middle part where the logical volume is listed on each, you can see a difference that will throw awk off.  In the first listing, there is a space between the lvol name , and the closing parenthesis ")".  In the second listing, there is no space.  This means that the $5 is the word "total" instead of the numerical size.  As a result of this, I see that the calculations are off like below due to this extra space:&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;/ora05                         is 360223.289 Mb&lt;BR /&gt;/ora06                         is 0.000 Mb&lt;BR /&gt;&lt;BR /&gt;Do you know how to account for this?</description>
      <pubDate>Fri, 14 Sep 2007 01:16:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070329#M94822</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-14T01:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070330#M94823</link>
      <description>I guess what I'm trying to figure out is how can I do an if, then, else type of logic to this?</description>
      <pubDate>Fri, 14 Sep 2007 01:24:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070330#M94823</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-14T01:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070331#M94824</link>
      <description>&amp;gt;I guess what I'm trying to figure out is how can I do an if, then, else type of logic to this?&lt;BR /&gt;&lt;BR /&gt;You should be able to do $(NF-3) to get that field.&lt;BR /&gt;$ df -l -k | grep total | awk '{print $(NF-3)}'</description>
      <pubDate>Fri, 14 Sep 2007 02:29:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070331#M94824</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-14T02:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070332#M94825</link>
      <description>Hi Patrick:&lt;BR /&gt;&lt;BR /&gt;Seeing 'grep' in a pipeline to 'awk' says you are WASTING resources.  'awk' is a pattern-matching engine!&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Dennis: You should be able to do $(NF-3) to get that field.&lt;BR /&gt;$ df -l -k | grep total | awk '{print $(NF-3)}'&lt;BR /&gt;&lt;BR /&gt;Eliminate the extra process:&lt;BR /&gt;&lt;BR /&gt;# df -l -k | awk '/total/ {print $(NF-3)}' &lt;BR /&gt;&lt;BR /&gt;...You even save your fingers from typing :-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 14 Sep 2007 06:45:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070332#M94825</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-14T06:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070333#M94826</link>
      <description>Thank you two!  I am now working on incorporating what you have showed me into what Hein van den Heuvel has provided.  If anyone wants to save me some time, I wouldn't mind.</description>
      <pubDate>Fri, 14 Sep 2007 09:40:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070333#M94826</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-14T09:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070334#M94827</link>
      <description>Ok, I figured it out:&lt;BR /&gt;&lt;BR /&gt;df -k -l | awk '&lt;BR /&gt;  /total/ &amp;amp;&amp;amp; !/ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/ebr/ {&lt;BR /&gt; printf ("%5f\n",$(NF-3)) &amp;gt;&amp;gt; "sizes.flatfiles"&lt;BR /&gt; } '&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Sep 2007 09:56:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070334#M94827</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-14T09:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070335#M94828</link>
      <description>&lt;!--!*#--&gt;Made another variation of Hein van den Heuvel's  grand total script:&lt;BR /&gt;&lt;BR /&gt;df -k -l | awk '&lt;BR /&gt; BEGIN {print "\nFlat Files\n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\n------------------\nTotal %3.3f Tb\n\n", t/1024/1024/1024) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt;  /total/ &amp;amp;&amp;amp; !/ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/ebr/ {&lt;BR /&gt; t+=$(NF-3);&lt;BR /&gt; printf ("%-35s is %5.3f Gb\n",$1,$(NF-3)/1024/1024) &amp;gt;&amp;gt; "sizes.report"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt; df -k -l | awk '&lt;BR /&gt; BEGIN {print "\nOracle Filesystems\n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\n------------------\nTotal %3.3f Tb\n\n", t/1024/1024/1024) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; /total/ &amp;amp;&amp;amp; /ora/ &amp;amp;&amp;amp; !/vg00/ &amp;amp;&amp;amp; !/storage/ {&lt;BR /&gt; t+=$(NF-3);&lt;BR /&gt; printf ("%-35s is %5.3f Gb\n",$1,$(NF-3)/1024/1024) &amp;gt;&amp;gt; "sizes.report"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt; df -k -l | awk '&lt;BR /&gt; BEGIN {print "\nEBR Filesystems\n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\n------------------\nTotal %3.3f Tb\n\n", t/1024/1024/1024) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; /total/ &amp;amp;&amp;amp; /ebr/ &amp;amp;&amp;amp; !/vg00/ {&lt;BR /&gt; t+=$(NF-3);&lt;BR /&gt; printf ("%-35s is %5.3f Gb\n",$1,$(NF-3)/1024/1024) &amp;gt;&amp;gt; "sizes.report"&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt;The code above creates sizes.report&lt;BR /&gt;&lt;BR /&gt;sizes.report output:&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;Flat Files&lt;BR /&gt;------------------&lt;BR /&gt;/usr/local                          is 2.291 Gb&lt;BR /&gt;/usr/local2                        is 0.118 Gb&lt;BR /&gt;/var/mqm                            is 9.170 Gb&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;Total 0.011 Tb&lt;BR /&gt;&lt;BR /&gt;Oracle Filesystems&lt;BR /&gt;------------------&lt;BR /&gt;/usr/local/oracle/10.2.0            is 7.795 Gb&lt;BR /&gt;/usr/local/oracle/9.2.0             is 5.686 Gb&lt;BR /&gt;/usr/local/oracle                   is 5.708 Gb&lt;BR /&gt;/usr/local/oracle2                  is 1.907 Gb&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;Total 0.020 Tb&lt;BR /&gt;&lt;BR /&gt;EBR Filesystems&lt;BR /&gt;------------------&lt;BR /&gt;/opt/app/ebr1           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr2           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr3           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr4           is 2031.505 Gb&lt;BR /&gt;/opt/app/ebr5           is 2029.520 Gb&lt;BR /&gt;/opt/app/ebr6           is 2029.520 Gb&lt;BR /&gt;&lt;BR /&gt;------------------&lt;BR /&gt;Total 11.894 Tb&lt;BR /&gt;&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;end sizes.report output&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The code below processes the file, and outputs a total of the totals:&lt;BR /&gt;&lt;BR /&gt;cat sizes.report | awk '&lt;BR /&gt; BEGIN {print "\nTotal Of All \n------------------" &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; END {printf ("\nTotal %3.3f Tb\n\n", t) &amp;gt;&amp;gt; "sizes.report"}&lt;BR /&gt; /Total/ {&lt;BR /&gt; t+=$(NF-1);&lt;BR /&gt; #printf ("%5.3f Tb\n",$(NF-1) &amp;gt;&amp;gt; "sizes.report")&lt;BR /&gt; } '&lt;BR /&gt;&lt;BR /&gt;The result is appended to the end of the file sizes.report:&lt;BR /&gt;&lt;BR /&gt;Total Of All&lt;BR /&gt;------------------&lt;BR /&gt;&lt;BR /&gt;Total 11.925 Tb&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Sep 2007 21:11:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070335#M94828</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2007-09-14T21:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying output from df -k in GB instead of KB</title>
      <link>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070336#M94829</link>
      <description>&lt;!-- !*# --&gt;&lt;P&gt;&amp;gt;Made another variation of Hein van den Heuvel's grand total script:&lt;BR /&gt;&lt;BR /&gt;Here is why you want to use grep and awk. You have three scripts that are very much alike. While you can use awk -v to pass in your report title (or do it outside), it is harder to get your RE to take a variable.&lt;BR /&gt;&lt;BR /&gt;See my solution in this thread:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1158757" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1158757&lt;/A&gt;&lt;BR /&gt;If you want the patterns to be variables:&lt;BR /&gt;awk -v p1="^003" -v p2="^abc" -v p3="^a13" -v p4="^next" '&lt;BR /&gt;$0 ~ p1 || $0 ~ p2 || $0 ~ p3 {&lt;BR /&gt;&lt;BR /&gt;You can also have functions in awk.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2011 01:13:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/displaying-output-from-df-k-in-gb-instead-of-kb/m-p/4070336#M94829</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-25T01:13:41Z</dc:date>
    </item>
  </channel>
</rss>

