<?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: Run awk script from within KSH script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5422499#M639872</link>
    <description>&lt;P&gt;&amp;gt;I have an AWK routine the successfully prints a warning message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how?&amp;nbsp; I had to change your script to:&lt;/P&gt;&lt;P&gt;df -k | awk '&lt;BR /&gt;{&lt;BR /&gt;if ($1 == "Filesystem")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; next&lt;BR /&gt;if (substr($0, 1, 1) == "/")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; filesys=$1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save filesystem name&lt;BR /&gt;FLD = -1&lt;BR /&gt;for (i=1; i&amp;lt;=NF; i++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if ($i ~ /%/) FLD=i&lt;BR /&gt;&lt;BR /&gt;if (FLD == -1 || $FLD ~ /-/) next&amp;nbsp; # skip all but lines with "%"&lt;BR /&gt;&lt;BR /&gt;usage = $(FLD - 1) + 0&amp;nbsp; # get previous field&lt;BR /&gt;if (usage &amp;gt;= 90)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print "Filesystem warning;" filesys, "usage at", usage "%"&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2011 06:02:34 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2011-12-20T06:02:34Z</dc:date>
    <item>
      <title>Run awk script from within KSH script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5421995#M639870</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please assist? I have an AWK routine the successfully prints a warning message for filesystem usage equal/greater than 90% when called as:&amp;nbsp; df -k | awk -f script.awk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to call the entire routine from within a KORN shell script. I can't seen to get it to work, please see below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;df -k | awk '{&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;if($1=="Filesystem")&lt;BR /&gt;next&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;for(i=1;i&amp;lt;=NF;i++)&lt;BR /&gt;&amp;nbsp;if($i ~/%/)&lt;BR /&gt;&amp;nbsp;FLD=i&lt;/P&gt;&lt;P&gt;&amp;nbsp;if($FLD !~/-/)&lt;BR /&gt;&amp;nbsp;usage=sprintf("%d\n", substr($FLD,1,index($FLD,"%")-1)+0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;if(usage&amp;gt;=90)&lt;BR /&gt;&amp;nbsp;printf("%s;%s%s%d%s\n", "Filesystem warning",$NF," usage at ",usage,"%")&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}'&lt;/P&gt;&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated, Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2011 17:51:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5421995#M639870</guid>
      <dc:creator>user909</dc:creator>
      <dc:date>2011-12-19T17:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Run awk script from within KSH script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5422001#M639871</link>
      <description>&lt;P&gt;&amp;gt;I would like to call the entire routine from within a KSH script. I can't seen to get it to work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's failing, what errors do you get?&lt;/P&gt;&lt;P&gt;You also seem to have an extra level of {} that you can remove:&lt;/P&gt;&lt;P&gt;df -k | awk '&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("%s;%s%s%d%s\n", "Filesystem warning", $NF, " usage at ", usage, "%")&lt;BR /&gt;}'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And it would help if you had more indentation.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2011 18:03:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5422001#M639871</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-19T18:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Run awk script from within KSH script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5422499#M639872</link>
      <description>&lt;P&gt;&amp;gt;I have an AWK routine the successfully prints a warning message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how?&amp;nbsp; I had to change your script to:&lt;/P&gt;&lt;P&gt;df -k | awk '&lt;BR /&gt;{&lt;BR /&gt;if ($1 == "Filesystem")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; next&lt;BR /&gt;if (substr($0, 1, 1) == "/")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; filesys=$1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # save filesystem name&lt;BR /&gt;FLD = -1&lt;BR /&gt;for (i=1; i&amp;lt;=NF; i++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if ($i ~ /%/) FLD=i&lt;BR /&gt;&lt;BR /&gt;if (FLD == -1 || $FLD ~ /-/) next&amp;nbsp; # skip all but lines with "%"&lt;BR /&gt;&lt;BR /&gt;usage = $(FLD - 1) + 0&amp;nbsp; # get previous field&lt;BR /&gt;if (usage &amp;gt;= 90)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print "Filesystem warning;" filesys, "usage at", usage "%"&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 06:02:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5422499#M639872</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-20T06:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Run awk script from within KSH script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5423281#M639873</link>
      <description>&lt;P&gt;Many thanks for the post.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 17:38:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5423281#M639873</guid>
      <dc:creator>user909</dc:creator>
      <dc:date>2011-12-20T17:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Run awk script from within KSH script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5423375#M639874</link>
      <description>&lt;P&gt;Or you could use bdfmegs -qP 90&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That will report nothing if no filesystems are 90% or larger, otherwise, one filesystem per line.&lt;/P&gt;&lt;P&gt;bdfmegs never splits long lines which makes it ideal for scripting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 19:29:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5423375#M639874</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2011-12-20T19:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Run awk script from within KSH script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5423581#M639875</link>
      <description>&lt;P&gt;&amp;gt;Many thanks for the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are happy, please click on the Kudos star.&lt;/P&gt;&lt;P&gt;And if it is a solution, you can use the post Options mention to mark it as a solution.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 23:24:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-awk-script-from-within-ksh-script/m-p/5423581#M639875</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-20T23:24:48Z</dc:date>
    </item>
  </channel>
</rss>

