<?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: Awk syntax in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448665#M729035</link>
    <description>Mike:&lt;BR /&gt;&lt;BR /&gt;Do this:&lt;BR /&gt;&lt;BR /&gt;Make your /tmp/stuff file like this:&lt;BR /&gt;&lt;BR /&gt;/tmp&lt;BR /&gt;/var&lt;BR /&gt;/home&lt;BR /&gt;&lt;BR /&gt;Then:&lt;BR /&gt;&lt;BR /&gt;for fs in `cat /tmp/stuff`&lt;BR /&gt;do&lt;BR /&gt;  space=`bdf|awk -v fs=$fs '$6==fs {print $5}'|cut -f1 -d"%"`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...adding whatever you want in the do-loop.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Thu, 28 Sep 2000 12:36:26 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2000-09-28T12:36:26Z</dc:date>
    <item>
      <title>Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448663#M729033</link>
      <description>I have a small script that is used to monitor and warn myself if certain filesystems exceed a set capacity ie more than 80% used etc.&lt;BR /&gt;&lt;BR /&gt;This is currently done using the following syntax :&lt;BR /&gt;&lt;BR /&gt;space=`bdf | awk '$6 == "/" {print $5}' | cut -f1 -d"%"`&lt;BR /&gt;&lt;BR /&gt;I would like to amend the script so filesystems are picked up from a configuration file instead of being hardcoded.  Intended syntax is something like :&lt;BR /&gt;&lt;BR /&gt;for fs in `cat filesystems`&lt;BR /&gt;do&lt;BR /&gt;  space=`bdf | awk '$6 == $fs {print $5}' | cut -f1 -d"%"`&lt;BR /&gt;&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;Appears that value for $fs is not being determined.  Awk fails with :&lt;BR /&gt;&lt;BR /&gt;awk: Field $() is not correct.&lt;BR /&gt; The input line number is 1.&lt;BR /&gt; The source line number is 1.&lt;BR /&gt;&lt;BR /&gt;Any ideas much appreciated.&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Thu, 28 Sep 2000 12:24:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448663#M729033</guid>
      <dc:creator>Mike Gordon</dc:creator>
      <dc:date>2000-09-28T12:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448664#M729034</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;within your awk $fs is not known because it's a shell variable.&lt;BR /&gt;To tell awk the variable $fs use:&lt;BR /&gt;space=`bdf | awk -v fs=$fs '$6 == $fs {print $5}' | cut -f1 -d"%"` &lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Andrew&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Sep 2000 12:33:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448664#M729034</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2000-09-28T12:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448665#M729035</link>
      <description>Mike:&lt;BR /&gt;&lt;BR /&gt;Do this:&lt;BR /&gt;&lt;BR /&gt;Make your /tmp/stuff file like this:&lt;BR /&gt;&lt;BR /&gt;/tmp&lt;BR /&gt;/var&lt;BR /&gt;/home&lt;BR /&gt;&lt;BR /&gt;Then:&lt;BR /&gt;&lt;BR /&gt;for fs in `cat /tmp/stuff`&lt;BR /&gt;do&lt;BR /&gt;  space=`bdf|awk -v fs=$fs '$6==fs {print $5}'|cut -f1 -d"%"`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...adding whatever you want in the do-loop.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 28 Sep 2000 12:36:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448665#M729035</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-09-28T12:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448666#M729036</link>
      <description>Sorry, if you assign a variable with -v var=value the within awk you must not use the $ before that var:&lt;BR /&gt;space=`bdf | awk -v fs=$fs '$6 == fs {print $5}' | cut -f1 -d"%"` &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Sep 2000 12:37:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448666#M729036</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2000-09-28T12:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448667#M729037</link>
      <description>Mike:&lt;BR /&gt;&lt;BR /&gt;Do this:&lt;BR /&gt;&lt;BR /&gt;Make your /tmp/stuff file like this:&lt;BR /&gt;&lt;BR /&gt;/tmp&lt;BR /&gt;/var&lt;BR /&gt;/home&lt;BR /&gt;&lt;BR /&gt;Then:&lt;BR /&gt;&lt;BR /&gt;for fs in `cat /tmp/stuff`&lt;BR /&gt;do&lt;BR /&gt;  space=`bdf|awk -v fs=$fs '$6==fs {print $5}'|cut -f1 -d"%"`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...adding whatever you want in the do-loop.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 28 Sep 2000 12:37:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448667#M729037</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-09-28T12:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448668#M729038</link>
      <description>You could also use the fact that bdf will take a filesystem as an argument:-&lt;BR /&gt;&lt;BR /&gt;for fs in $(&lt;FILESYSTEMS&gt;&lt;/FILESYSTEMS&gt;do&lt;BR /&gt;space=$(bdf ${fs} | tail -1|awk '{print $5}')&lt;BR /&gt;space=${space%%\%}&lt;BR /&gt;etc etc&lt;BR /&gt;done</description>
      <pubDate>Thu, 28 Sep 2000 12:39:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448668#M729038</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2000-09-28T12:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448669#M729039</link>
      <description>Or without using 'tail':-&lt;BR /&gt;&lt;BR /&gt;for fs in $(&lt;FILESYSTEMS&gt;&lt;/FILESYSTEMS&gt;do&lt;BR /&gt;space=$(bdf ${fs} | awk '{if ($1 ~ /\//) {print $5}}')&lt;BR /&gt;space=${space%%\%}&lt;BR /&gt;etc etc...&lt;BR /&gt;done</description>
      <pubDate>Thu, 28 Sep 2000 12:45:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448669#M729039</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2000-09-28T12:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448670#M729040</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;Use this script...&lt;BR /&gt;&lt;BR /&gt;.....&lt;BR /&gt;&lt;BR /&gt;current_mounted_fs=`bdf | grep "/" | &lt;BR /&gt;   awk '{if (NF == 6) {print $6}}; &lt;BR /&gt;   (NF == 5) {print $5}'`&lt;BR /&gt;&lt;BR /&gt;for fs in $current_mounted_fs&lt;BR /&gt;do&lt;BR /&gt;    used_rate=`bdf $fs | grep $fs &lt;BR /&gt;        | awk '{if (NF == 6) {print $5}}; &lt;BR /&gt;        (NF == 5) {print $4}' &lt;BR /&gt;        | awk -F% '{print $1}'`&lt;BR /&gt;    if [ $used_rate -gt 80 ] ; then&lt;BR /&gt;      echo "Waring! $fs used $used_rate% ..."&lt;BR /&gt;    fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;.....</description>
      <pubDate>Fri, 29 Sep 2000 03:36:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448670#M729040</guid>
      <dc:creator>박수정</dc:creator>
      <dc:date>2000-09-29T03:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448671#M729041</link>
      <description>Bear in mind though the "-v" parameter is an extension to the awk syntax, and might not work on all platforms.&lt;BR /&gt;&lt;BR /&gt;So you could also use double quotes in stead of single, like so :&lt;BR /&gt;  space=`bdf | awk "$6 == $fs {print $5}" | cut -f1 -d"%"`&lt;BR /&gt;&lt;BR /&gt;cheers</description>
      <pubDate>Fri, 29 Sep 2000 05:50:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448671#M729041</guid>
      <dc:creator>Werner Vergauwen</dc:creator>
      <dc:date>2000-09-29T05:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448672#M729042</link>
      <description>Here's a fragment that I wrote for my own use.  As written it alerts you when any file system is 90% or greater capacity:&lt;BR /&gt;&lt;BR /&gt;if [ "`/usr/bin/bdf | grep dev |   /usr/bin/awk '{print $5}' |   /usr/bin/sed 's/\%//g' |   /usr/bin/awk '&lt;BR /&gt;   {if($0&amp;gt;=90){print "OVER"}}&lt;BR /&gt;   '`" != "" ]&lt;BR /&gt;then&lt;BR /&gt;   # here you can send email or whatever&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Sep 2000 14:33:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448672#M729042</guid>
      <dc:creator>Fred Martin_1</dc:creator>
      <dc:date>2000-09-29T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Awk syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448673#M729043</link>
      <description>Sorry, a lot was lost in the translation in that last message.  I have included the script as an attachment here.&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Sep 2000 14:40:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-syntax/m-p/2448673#M729043</guid>
      <dc:creator>Fred Martin_1</dc:creator>
      <dc:date>2000-09-29T14:40:41Z</dc:date>
    </item>
  </channel>
</rss>

