<?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 command not working in shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016982#M96779</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;To skip the header line you could do:&lt;BR /&gt;&lt;BR /&gt;# bdf /var |sed 's/%//'|awk '{if (NR&amp;gt;1 &amp;amp;&amp;amp; $5 &amp;gt;= 90) print $0;}' &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 05 Dec 2006 10:42:51 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-12-05T10:42:51Z</dc:date>
    <item>
      <title>awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016980#M96777</link>
      <description>&lt;P&gt;I am trying to grab output from awk utility in a script and email the output but script is failing. On HP 11 platform, I trying to get the fifth field from "bdf /var" output and send myself an email if /var is 90% or more full but I have not been able to get it right.&lt;BR /&gt;&lt;BR /&gt;Output is needed for second line as first line has the header, not disk info. Here is what I wrote:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;bdf /var |sed 's/%//'|awk '{if ($5 &amp;gt;= 90) print $0;}'|mailx -s"`hostname` -File system full" MyId@email.com&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;And bdf output is like this:&lt;BR /&gt;Server&amp;gt; bdf&lt;BR /&gt;Filesystem kbytes used avail %used Mounted on&lt;BR /&gt;/dev/vg00/lvol7 4194304 1756256 2422400 42% /var&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.This thread has been moved from HP-UX&amp;gt;General HP-UX &amp;gt; languages-HP Forums Moderator&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2013 02:38:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016980#M96777</guid>
      <dc:creator>vz7r1x</dc:creator>
      <dc:date>2013-03-11T02:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016981#M96778</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;and welcome to the forums !&lt;BR /&gt;&lt;BR /&gt;You may be interested in reading:&lt;BR /&gt;&lt;A href="https://community.hpe.com/t5/forums/searchpage/tab/message?q=awk+command+" target="_blank"&gt;https://community.hpe.com/t5/forums/searchpage/tab/message?q=awk+command+&lt;/A&gt;&lt;BR /&gt;Please also read:&lt;BR /&gt;&lt;A href="https://community.hpe.com/t5/Community-FAQ/FAQ-Kudos/td-p/6838486" target="_blank"&gt;https://community.hpe.com/t5/Community-FAQ/FAQ-Kudos/td-p/6838486&lt;/A&gt; on how to reward any useful answers given to your questions.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 08:17:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016981#M96778</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2017-03-24T08:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016982#M96779</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;To skip the header line you could do:&lt;BR /&gt;&lt;BR /&gt;# bdf /var |sed 's/%//'|awk '{if (NR&amp;gt;1 &amp;amp;&amp;amp; $5 &amp;gt;= 90) print $0;}' &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Dec 2006 10:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016982#M96779</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-05T10:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016983#M96780</link>
      <description>&lt;!--!*#--&gt;Islam,&lt;BR /&gt;&lt;BR /&gt;Here's an adaptation of a script I use to check/copy Oracle archivelogs:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i SIZE=$(bdf /var| awk '{getline; sub(/%/,""); print $5;}')&lt;BR /&gt;if [[ $SIZE -gt 90 ]]&lt;BR /&gt;then&lt;BR /&gt;  mailx -m -s "[$(date +%m\/%d\/%y)] $(hostname) /var at 90+%!" your@email.addr &lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Tue, 05 Dec 2006 10:43:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016983#M96780</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-12-05T10:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016984#M96781</link>
      <description>how about the awk below:&lt;BR /&gt;&lt;BR /&gt;# bdf /var | awk 'z[split($5,z,"%")-1]&amp;gt;=90' | mailx -s "FileSys &amp;gt; 90%" abc@xyz.com</description>
      <pubDate>Tue, 05 Dec 2006 10:46:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016984#M96781</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-12-05T10:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016985#M96782</link>
      <description>HI,&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;if you do not want header remove "NR==1||".&lt;BR /&gt;if you want different percentage to check chnage PCT=90 as you prefer.&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Wed, 06 Dec 2006 05:50:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016985#M96782</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-12-06T05:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: awk command not working in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016986#M96783</link>
      <description>Thanks for great responses. I used Spex's suggestion to resolve the issue.</description>
      <pubDate>Wed, 06 Dec 2006 07:12:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-command-not-working-in-shell-script/m-p/5016986#M96783</guid>
      <dc:creator>vz7r1x</dc:creator>
      <dc:date>2006-12-06T07:12:30Z</dc:date>
    </item>
  </channel>
</rss>

