<?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: grep bdf for aavail &amp;gt; number in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191514#M791995</link>
    <description>In AWK mormally you count fields from the beginning of the line in.&lt;BR /&gt;The one liner below will handle the split lines from bdf transparantly by using NF (number of fields) to address fields relative to the end. It test for AVAIL &amp;gt; 4000000 and prints avail and mouintpoint.&lt;BR /&gt;&lt;BR /&gt;bdf | awk '(NF&amp;lt;4){next} ($(NF-2) &amp;gt; 4000000) {print $(NF-2), $NF}'&lt;BR /&gt;&lt;BR /&gt;Now if you want the filesystem printed too then it becomes more tricky. You need to remember it from the last line read with just 1 field and only pick up the current one if the re are 6 fields. Example&lt;BR /&gt;&lt;BR /&gt;bdf | awk '(NF&amp;lt;5){f=$1; next} (NF&amp;gt;5){f=$1} ($(NF-2) &amp;gt; 4000000) {print f, $(NF-2), $NF}'&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Fri, 13 Feb 2004 11:27:41 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-02-13T11:27:41Z</dc:date>
    <item>
      <title>grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191504#M791985</link>
      <description>Hello all, &lt;BR /&gt;&lt;BR /&gt;Would like to know how to perform bdf, grep on 'avail' column for all filesystems greater than a given size. Also want to display all columns from bdf.  &lt;BR /&gt;So far below cmd prints all fields (no spaces) but picks only one record from bdf (the matching one, I want to test for all &amp;gt; 4000000):&lt;BR /&gt;bdf|tr -s " " ||awk '{print $1 $2 $3 $4}'cut -f 2 -d " " |grep 4000000&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Fri, 13 Feb 2004 08:28:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191504#M791985</guid>
      <dc:creator>Warren Cook_2</dc:creator>
      <dc:date>2004-02-13T08:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191505#M791986</link>
      <description>Warren,&lt;BR /&gt;&lt;BR /&gt;I'm reasonable certain I've seen something like this before and I'm willing to bet that I saw it in one of Bill McNamara's "Favorite Scripts" threads.  Here's the first one, which also provides links to the other two.  Have a look through them.  Even if you don't find exactly what you're looking for, they're an invaluable resource.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 13 Feb 2004 08:45:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191505#M791986</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2004-02-13T08:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191506#M791987</link>
      <description>Warren,&lt;BR /&gt;Try this -&lt;BR /&gt;&lt;BR /&gt;for a in $(bdf |awk '{print $4}')&lt;BR /&gt;do&lt;BR /&gt;  if [[ "$a" != "avail" ]]&lt;BR /&gt;  then&lt;BR /&gt;      if [[ $a -gt 4000000 ]]&lt;BR /&gt;      then&lt;BR /&gt;          echo Bigger than 4000000&lt;BR /&gt;      fi&lt;BR /&gt;   fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope this works, it did on my system.&lt;BR /&gt;Regards,&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;.</description>
      <pubDate>Fri, 13 Feb 2004 08:59:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191506#M791987</guid>
      <dc:creator>Peter Day_2</dc:creator>
      <dc:date>2004-02-13T08:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191507#M791988</link>
      <description>bdf|awk '{if($4&amp;gt;=106000) print $4}'</description>
      <pubDate>Fri, 13 Feb 2004 09:03:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191507#M791988</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-02-13T09:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191508#M791989</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Since for long file system names bdf uses 2 lines this is difficult to realise easily&lt;BR /&gt;&lt;BR /&gt;df -n|cut -f2 -d"("|cut -f1 -d ")"|while read line&lt;BR /&gt;do&lt;BR /&gt;   xx=$(bdf $line|tail -n +2)&lt;BR /&gt;   echo $xx|while read a b rest&lt;BR /&gt;       do&lt;BR /&gt;          let val=$b&lt;BR /&gt;             if [ "$val" -gt "4000000" ]&lt;BR /&gt;             then&lt;BR /&gt;               echo $xx&lt;BR /&gt;             fi&lt;BR /&gt;       done&lt;BR /&gt;done|sort -n&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;               Steve Steel</description>
      <pubDate>Fri, 13 Feb 2004 09:05:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191508#M791989</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2004-02-13T09:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191509#M791990</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;IZE=512000&lt;BR /&gt;OLDIFS=$IFS&lt;BR /&gt;IFS="&lt;BR /&gt;"&lt;BR /&gt;for LINE in `bdf`; do&lt;BR /&gt;   FIELD2=`echo $LINE|tr -s " "|awk '{print $2 }'` &lt;BR /&gt;   FS_SIZE=`echo $FIELD2|tr -d "[:alpha:]" `&lt;BR /&gt;   if [[ "$FS_SIZE" -ge $SIZE ]]; then&lt;BR /&gt;      echo $LINE&lt;BR /&gt;   fi&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 09:08:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191509#M791990</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-02-13T09:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191510#M791991</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;Thank-you all for great and quick feedback !   I've tried all suggestions and will assign points shortly.&lt;BR /&gt;&lt;BR /&gt;Mark, I'm using your suggestion, I can't get the IF to work.  It appears to be comparing strings and always gives a true answer, so all bdf records are printed.  I've tried several variations with no luck ... if you or anyone has a suggestion.&lt;BR /&gt;&lt;BR /&gt;I mean this if:&lt;BR /&gt;if [[ "$FS_SIZE" -ge $SIZE ]]; then&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Fri, 13 Feb 2004 10:43:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191510#M791991</guid>
      <dc:creator>Warren Cook_2</dc:creator>
      <dc:date>2004-02-13T10:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191511#M791992</link>
      <description>bdf | awk '$2&amp;gt;4000000'&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 10:55:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191511#M791992</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-02-13T10:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191512#M791993</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;bdf is not my favorite for checking the utilizations due to below warning from the man page of bdf.&lt;BR /&gt;&lt;BR /&gt;WARNINGS&lt;BR /&gt;      If file system names are too long, the output for a given entry is&lt;BR /&gt;      displayed on two lines.&lt;BR /&gt;&lt;BR /&gt;This can confuse your script quite a bit. So, I would write the script using 'df' something like this&lt;BR /&gt;&lt;BR /&gt;LIMIT=100000&lt;BR /&gt;&lt;BR /&gt;cleanup()&lt;BR /&gt;{&lt;BR /&gt;rm -f /tmp/fs$$ /tmp/fsreport$$&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;trap cleanup 0 1 2&lt;BR /&gt;&lt;BR /&gt;for FS in $(df -l|awk '{print $1}')&lt;BR /&gt;do&lt;BR /&gt;AVAIL=$(df -k $FS|awk '/free allocated Kb/ {print $1}')&lt;BR /&gt;if [ $AVAIL -ge $LIMIT ]&lt;BR /&gt;then&lt;BR /&gt;bdf $FS |sed '1d'&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Adjust your if's and limits accordingly.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 10:56:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191512#M791993</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-13T10:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191513#M791994</link>
      <description>oops .. missed the "no spaces part"&lt;BR /&gt;&lt;BR /&gt;bdf | tr -s " " | awk '$2&amp;gt;4000000'</description>
      <pubDate>Fri, 13 Feb 2004 11:19:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191513#M791994</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-02-13T11:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191514#M791995</link>
      <description>In AWK mormally you count fields from the beginning of the line in.&lt;BR /&gt;The one liner below will handle the split lines from bdf transparantly by using NF (number of fields) to address fields relative to the end. It test for AVAIL &amp;gt; 4000000 and prints avail and mouintpoint.&lt;BR /&gt;&lt;BR /&gt;bdf | awk '(NF&amp;lt;4){next} ($(NF-2) &amp;gt; 4000000) {print $(NF-2), $NF}'&lt;BR /&gt;&lt;BR /&gt;Now if you want the filesystem printed too then it becomes more tricky. You need to remember it from the last line read with just 1 field and only pick up the current one if the re are 6 fields. Example&lt;BR /&gt;&lt;BR /&gt;bdf | awk '(NF&amp;lt;5){f=$1; next} (NF&amp;gt;5){f=$1} ($(NF-2) &amp;gt; 4000000) {print f, $(NF-2), $NF}'&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 11:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191514#M791995</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-02-13T11:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191515#M791996</link>
      <description>Here's a nice little script that handles bdf's split lines nicely and formats bdf output nicely as well.  We use it a lot to find out how much space is left within a certain percentage limit (the -p option). &lt;BR /&gt;&lt;BR /&gt;Anyway, "dfspace | awk '{if ($4 &amp;gt; 40000) {print$0}}'" should produce your results and avoid the bdf 2-line limitation.</description>
      <pubDate>Tue, 17 Feb 2004 14:37:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191515#M791996</guid>
      <dc:creator>Arnold Hausmann</dc:creator>
      <dc:date>2004-02-17T14:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: grep bdf for aavail &gt; number</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191516#M791997</link>
      <description>Here is a script I call bdfmegs. It always produces a single line for every filesystem. There is a -v option for additional filesystem details (like large-files). Best of all, all the numbers are in megs, not kbytes.</description>
      <pubDate>Tue, 17 Feb 2004 21:23:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-bdf-for-aavail-gt-number/m-p/3191516#M791997</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-02-17T21:23:14Z</dc:date>
    </item>
  </channel>
</rss>

