<?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>Thema "Re: awk Query." in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781464#M263329</link>
    <description>&amp;gt;Urszula: Hi Arturo, why +0 is needed here.&lt;BR /&gt;&lt;BR /&gt;Peter had it first.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but do not get why the +0 is needed. works the same without +0.&lt;BR /&gt;&lt;BR /&gt;Two possible reasons.&lt;BR /&gt;1) To convert to numeric so a string compare isn't done.&lt;BR /&gt;2) To handle the case of substr returning an empty string?</description>
    <pubDate>Thu, 27 Mar 2008 05:03:33 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-03-27T05:03:33Z</dc:date>
    <item>
      <title>awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781450#M263315</link>
      <description>I am doing following awk command and get output as follows.&lt;BR /&gt;&lt;BR /&gt;ssh -q abcxyz 'bdf /var /tmp'|awk -v sd=nxdrpap3 '{print sd} /^\/dev/ {print $0}'   &lt;BR /&gt;abcxyz&lt;BR /&gt;abcxyz&lt;BR /&gt;/dev/vg00/lvol7    2048000 1705778  321956   84% /var&lt;BR /&gt;abcxyz&lt;BR /&gt;/dev/vg00/lvol5    1024000  542751  452955   55% /tmp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want it to be as follows.&lt;BR /&gt;abcxyz&lt;BR /&gt;/dev/vg00/lvol7    2048000 1705778  321956   84% /var&lt;BR /&gt;/dev/vg00/lvol5    1024000  542751  452955   55% /tmp&lt;BR /&gt;&lt;BR /&gt;How do I put awk statement then?</description>
      <pubDate>Wed, 03 May 2006 02:17:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781450#M263315</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-05-03T02:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781451#M263316</link>
      <description>Place the BEGIN construct before the hostname (I assume) modifying it as...&lt;BR /&gt;&lt;BR /&gt;ssh -q abcxyz 'bdf /var /tmp'|awk -v sd=nxdrpap3 'BEGIN {print sd} /^\/dev/'</description>
      <pubDate>Wed, 03 May 2006 02:32:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781451#M263316</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-03T02:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781452#M263317</link>
      <description>How to add some checking? Print only if bdf is more than 50% used.</description>
      <pubDate>Wed, 03 May 2006 02:40:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781452#M263317</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-05-03T02:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781453#M263318</link>
      <description>ssh -q abcxyz 'bdf /var /tmp'|awk -v sd=nxdrpap3 'BEGIN {print sd} /^\/dev/{if($(NF-1)&amp;gt;50)print $0}'</description>
      <pubDate>Wed, 03 May 2006 02:50:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781453#M263318</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-03T02:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781454#M263319</link>
      <description>This would print abcxyz, even if no bdfs are more than 50%. (for example.)&lt;BR /&gt;&lt;BR /&gt;Above, I want FS more than 85%, and there are none. But your awk contruct will still print abcxyz. I do not want that. If no FSs are more than 85%, it should not print anything at all, Else print hostname and FSs that are more than threshold specified.</description>
      <pubDate>Wed, 03 May 2006 02:57:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781454#M263319</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-05-03T02:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781455#M263320</link>
      <description>Okay I finally understand what you're trying to get at. Looks like you will need a multi-pipeline of awk's i.e.&lt;BR /&gt;&lt;BR /&gt;ssh -q awhq7135 'bdf /var /tmp' | awk '/^\/dev/{if($(NF-1)&amp;gt;90)print $0}' |&lt;BR /&gt;awk -v sd=nxdrpap3 '{if(NR==1)print sd"\n"$0;else print $0}'&lt;BR /&gt;&lt;BR /&gt;The first awk pipe filters out the FS based on the &amp;gt;50% criterion and the second awk pipeline prints out the hostname and those FS's that are &amp;gt;50% capacity otherwise it prints nothing.&lt;BR /&gt;&lt;BR /&gt;hope it helps!</description>
      <pubDate>Wed, 03 May 2006 03:19:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781455#M263320</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-03T03:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781456#M263321</link>
      <description>Wrong criteria (&amp;gt;90) in the last posting, instead use the one below...&lt;BR /&gt;&lt;BR /&gt;ssh -q abcxyz 'bdf /var /tmp' | awk '/^\/dev/{if($(NF-1)&amp;gt;50)print $0}' |&lt;BR /&gt;awk -v sd=nxdrpap3 '{if(NR==1)print sd"\n"$0;else print $0}'</description>
      <pubDate>Wed, 03 May 2006 03:22:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781456#M263321</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-03T03:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781457#M263322</link>
      <description>In fact, I am doing following. I need output only if wait and avserv is greate than 250 and %busy greater than 50%. I am using follwoing, but it prints following also. It should print only if above all conditions are met. In such case, it should print host name and data. (data if wait and aserv greater than 250 and %busy greater than 50)&lt;BR /&gt;&lt;BR /&gt;Wrong outout-&lt;BR /&gt;lmnop&lt;BR /&gt;00:00:01 00:00:01   device   %busy   avque   r+w/s  blks/s  avwait  avserv&lt;BR /&gt;02:30:00           c55t3d6   76.55   17.41      36    3311  253.57  101.92&lt;BR /&gt;&lt;BR /&gt;abcxyz&lt;BR /&gt;00:00:00 00:00:00   device   %busy   avque   r+w/s  blks/s  avwait  avserv&lt;BR /&gt;&lt;BR /&gt;I should get only&lt;BR /&gt;lmnop&lt;BR /&gt;00:00:01 00:00:01   device   %busy   avque   r+w/s  blks/s  avwait  avserv&lt;BR /&gt;02:30:00           c55t3d6   76.55   17.41      36    3311  253.57  101.92&lt;BR /&gt;&lt;BR /&gt;I am using following.&lt;BR /&gt;for i in lmnop abcxyz&lt;BR /&gt;do&lt;BR /&gt;remsh ${i} 'cat /var/adm/sa/sar02'|/usr/bin/sed -n '/device/,/Average/p'|egrep -iv "^$|Average"|awk '/^[0-9][0-9&lt;BR /&gt;]:/{t=$1} /avserv$/;{if (NR==1 || (NF==8 &amp;amp;&amp;amp; $(NF-1)&amp;gt;250) || (NF==7 &amp;amp;&amp;amp;  $(NF-1)&amp;gt;250)) print t,$0}'|egrep -v '^[0-&lt;BR /&gt;9][0-9]:[0-9][0-9]:[0-9][0-9]   device'|awk  '{if ($NF&amp;gt;50) print $0}'|awk '{if ($3&amp;gt;50) print $0}'|awk -v sd=${i}&lt;BR /&gt; '{if(NR==1)print sd"\n"$0"\n";else print $0}'&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 03:51:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781457#M263322</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-05-03T03:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781458#M263323</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;to output conditionally, collect your data in an array. My example is based on the original bdf-question:&lt;BR /&gt;&lt;BR /&gt;bdf -l |&lt;BR /&gt;awk -v h=hp9 -v lim=85 '/^\/dev/ {lev=substr($(NF-1),1,length($(NF-1)-1))+0;&lt;BR /&gt;if(lev&amp;gt;lim) l[++n]=$0}&lt;BR /&gt;END {if(n) {print h;for(j=1;j&amp;lt;=n;j++) print l[j]}}'&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 03 May 2006 04:37:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781458#M263323</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-03T04:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781459#M263324</link>
      <description>Hi (again),&lt;BR /&gt;&lt;BR /&gt;after reviewing your request of sar-data, I suggest to perform the whole task in awk (set your busy+avwait limits to your needs):&lt;BR /&gt;&lt;BR /&gt;for h in host1 host2&lt;BR /&gt;do&lt;BR /&gt;remsh $h -n cat /var/adm/sa/sar02 |&lt;BR /&gt;awk -v busy=5 -v wait=7 -v h=$h '$2 == "device" {report=1;header=$0;next}&lt;BR /&gt;/^Average/ {report=0;next}&lt;BR /&gt;NF &amp;amp;&amp;amp; report {if(($(NF-5)+0 &amp;gt;busy) || ($(NF-1)+0 &amp;gt;wait)) l[++n]=$0 }&lt;BR /&gt;END {if(n) {print h;print header;for(j=1;j&amp;lt;=n;j++) print l[j]}}'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 03 May 2006 07:57:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781459#M263324</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-03T07:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781460#M263325</link>
      <description>&lt;BR /&gt;As you go, remember the header lines.&lt;BR /&gt;&lt;BR /&gt;Then when the reporting condition is triggered, print the header if not yet printed and print the trigger line.&lt;BR /&gt;&lt;BR /&gt;Sticking to the df example, using the sd header variable itself as the flag:&lt;BR /&gt;&lt;BR /&gt;# df&lt;BR /&gt;Filesystem           1k-blocks      Used Available Use% Mounted on&lt;BR /&gt;/dev/hda2                60928     60928         0 100% /&lt;BR /&gt;/dev/hda3                54405     43810     10595  81% /mnt&lt;BR /&gt;/dev/hda1                 1743      1571       172  90% /boot&lt;BR /&gt;/dev/loop0                 979        15       914   2% //mnt/root # df | awk -v sd=abc '/Use%/ {sd = sd "\n" $0} /^.dev/ &amp;amp;&amp;amp; ($(NF-1) &amp;gt; 99) { if (sd) { print sd; sd=""} print} '&lt;BR /&gt; # df | awk -v sd=abc '/Use%/ {sd = sd "\n" $0} /^.dev/ &amp;amp;&amp;amp; ($(NF-1) &amp;gt; 80) { if (sd) { print sd; sd=""} print} '&lt;BR /&gt;abc&lt;BR /&gt;Filesystem           1k-blocks      Used Available Use% Mounted on&lt;BR /&gt;/dev/hda3                54405     43810     10595  81% /mnt&lt;BR /&gt;/dev/hda1                 1743      1571       172  90% /boot&lt;BR /&gt;&lt;BR /&gt;Using a seperate flag this looks like:&lt;BR /&gt;&lt;BR /&gt;df | awk -v sd=abc '/Use%/ {sd = sd "\n" $0} /^.dev/ &amp;amp;&amp;amp; ($(NF-1) &amp;gt; 80) { if (!header++) { print sd } print} '      &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That is, when the condition is met, test and increment header. If it was not true (0) then print header text. From now on it is no longer zero no matter how many more lines print.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 09:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781460#M263325</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-03T09:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781461#M263326</link>
      <description>My two cents&lt;BR /&gt;&lt;BR /&gt;bdf|awk -v PCT=60 'NR==1||substr($5,1,index($5,"%")-1)+0&amp;gt;=PCT' &amp;gt;&amp;gt; daily_${dcheck&lt;BR /&gt;}_$(hostname).log&lt;BR /&gt;&lt;BR /&gt;(This will show all filesystems that are in use above 60%)&lt;BR /&gt;&lt;BR /&gt;No points pls. This is what i used from one of our members here on the forums sometime back.</description>
      <pubDate>Wed, 03 May 2006 09:52:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781461#M263326</guid>
      <dc:creator>Anil C. Sedha</dc:creator>
      <dc:date>2006-05-03T09:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781462#M263327</link>
      <description>Hi,&lt;BR /&gt;I'm the author:&lt;BR /&gt;# Show mount points over PCT&lt;BR /&gt;bdf|awk -v PCT=90 'NR==1||substr($5,1,index($5,"%")-1)+0&amp;gt;=PCT'&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Thu, 04 May 2006 03:15:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781462#M263327</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-05-04T03:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781463#M263328</link>
      <description>Hi Arturo, why +0 is needed here.&lt;BR /&gt;bdf|awk -v PCT=90 'NR==1||substr($5,1,index($5,"%")-1)+0&amp;gt;=PCT'&lt;BR /&gt;&lt;BR /&gt;I found the above posting very useful and really nice for what I needed to do but do not get why the +0 is needed. works the same without +0.Could you please explain it?&lt;BR /&gt;Thank you</description>
      <pubDate>Wed, 26 Mar 2008 15:00:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781463#M263328</guid>
      <dc:creator>Urszula Gronkiewicz</dc:creator>
      <dc:date>2008-03-26T15:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781464#M263329</link>
      <description>&amp;gt;Urszula: Hi Arturo, why +0 is needed here.&lt;BR /&gt;&lt;BR /&gt;Peter had it first.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but do not get why the +0 is needed. works the same without +0.&lt;BR /&gt;&lt;BR /&gt;Two possible reasons.&lt;BR /&gt;1) To convert to numeric so a string compare isn't done.&lt;BR /&gt;2) To handle the case of substr returning an empty string?</description>
      <pubDate>Thu, 27 Mar 2008 05:03:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781464#M263329</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-03-27T05:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781465#M263330</link>
      <description>&lt;!--!*#--&gt;hi,&lt;BR /&gt;&lt;BR /&gt;just out of curiosity, i ran the command and this does not seem to work!!&lt;BR /&gt;&lt;BR /&gt;SRV2:&amp;gt;bdf /d01&lt;BR /&gt;Filesystem          kbytes    used   avail %used Mounted on&lt;BR /&gt;/dev/vgappinst/lv_appinst&lt;BR /&gt;                   20963328 20062972  900356   96% /d01&lt;BR /&gt;SVR2:&amp;gt;bdf|awk -v PCT=90 'NR==1||substr($5,1,index($5,"%")-1)+0&amp;gt;=PCT'&lt;BR /&gt;Filesystem          kbytes    used   avail %used Mounted on&lt;BR /&gt;SVR2:&amp;gt;&lt;BR /&gt;&lt;BR /&gt;did i miss anything?&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Mar 2008 05:18:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781465#M263330</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-03-27T05:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: awk Query.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781466#M263331</link>
      <description>&lt;!--!*#--&gt;hi again,&lt;BR /&gt;&lt;BR /&gt;I think i found my mistake!&lt;BR /&gt;&lt;BR /&gt;When the row of the bdf output for a specific file system spans over more than 1 line, it does not work!&lt;BR /&gt;&lt;BR /&gt;tried the same but with bdfmegs&lt;BR /&gt;&lt;BR /&gt;SRV2:home/yogeeraj&amp;gt;./bdfmegs|awk -v PCT=90 'NR==1||substr($5,1,index($5,"%")-1)+0&amp;gt;=PCT'&lt;BR /&gt;File System                      Mbytes    Used   Avail %Used Mounted on&lt;BR /&gt;/dev/vgpfsdb01/lv_pfsdb01         20472   20365     105   99% /d10&lt;BR /&gt;/dev/vgappinst/lv_appinst         20472   19593     879   96% /d01&lt;BR /&gt;/dev/vgorarestore/lv_orarestore   35828   33831    1997   94% /RESTORE&lt;BR /&gt;SRV2:home/yogeeraj&amp;gt;&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Thu, 27 Mar 2008 05:24:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-query/m-p/3781466#M263331</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-03-27T05:24:21Z</dc:date>
    </item>
  </channel>
</rss>

