<?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: Scripting help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094082#M310735</link>
    <description>Rex&amp;gt;&amp;gt; grep HI FILENAME |awk '{print $1}' &lt;BR /&gt;&lt;BR /&gt;Hmmm, thanks for playing, but that's just so wrong on so many levels!&lt;BR /&gt;&lt;BR /&gt;1) Why bring our attention back to a problem with a perfect solution?&lt;BR /&gt;&lt;BR /&gt;2) Why pipe through grep when awk is perfectly happy to read the file directly and pretty much designed to do the filtering. ( awk '/HI/{print $1}' FILENAME )&lt;BR /&gt;&lt;BR /&gt;but most importantly...&lt;BR /&gt;&lt;BR /&gt;3) this 'solution' will have false positives for records where other columns happen to have the character sequence HI in them&lt;BR /&gt;&lt;BR /&gt;4) this 'solution' will have false negatives for cases where column 6 is not 0, but not HI either.&lt;BR /&gt;&lt;BR /&gt;The question/requirement was&lt;BR /&gt;&lt;BR /&gt;"If the value of the 6th field is non zero"&lt;BR /&gt;&lt;BR /&gt;Cheers!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 31 Oct 2007 09:47:14 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2007-10-31T09:47:14Z</dc:date>
    <item>
      <title>Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094079#M310732</link>
      <description>hello Gurus,&lt;BR /&gt;&lt;BR /&gt;I have a file which has some 10 coloumns. If the value of the 6th field is non zero value then i need to print out first field&lt;BR /&gt;&lt;BR /&gt;STWBK01  2979   WNT  FTA    40    0&lt;BR /&gt;USTWNA01 2979   WNT  FTA    40    0&lt;BR /&gt;USTWA448 2979   WNT  FTA    40    HI&lt;BR /&gt;&lt;BR /&gt;Now i want the output as &lt;BR /&gt;&lt;BR /&gt;USTWA448 &lt;BR /&gt;&lt;BR /&gt;As the 6th field here is not 0 but HI. &lt;BR /&gt;&lt;BR /&gt;what awk combination shall i use to get this?&lt;BR /&gt;&lt;BR /&gt;thanks in advance&lt;BR /&gt;George &lt;BR /&gt;</description>
      <pubDate>Tue, 30 Oct 2007 02:15:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094079#M310732</guid>
      <dc:creator>George Chechakunnil</dc:creator>
      <dc:date>2007-10-30T02:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094080#M310733</link>
      <description># awk '$6!=0 {print $1}' file</description>
      <pubDate>Tue, 30 Oct 2007 02:28:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094080#M310733</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-10-30T02:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094081#M310734</link>
      <description>grep HI FILENAME |awk '{print $1}'</description>
      <pubDate>Wed, 31 Oct 2007 08:59:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094081#M310734</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2007-10-31T08:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094082#M310735</link>
      <description>Rex&amp;gt;&amp;gt; grep HI FILENAME |awk '{print $1}' &lt;BR /&gt;&lt;BR /&gt;Hmmm, thanks for playing, but that's just so wrong on so many levels!&lt;BR /&gt;&lt;BR /&gt;1) Why bring our attention back to a problem with a perfect solution?&lt;BR /&gt;&lt;BR /&gt;2) Why pipe through grep when awk is perfectly happy to read the file directly and pretty much designed to do the filtering. ( awk '/HI/{print $1}' FILENAME )&lt;BR /&gt;&lt;BR /&gt;but most importantly...&lt;BR /&gt;&lt;BR /&gt;3) this 'solution' will have false positives for records where other columns happen to have the character sequence HI in them&lt;BR /&gt;&lt;BR /&gt;4) this 'solution' will have false negatives for cases where column 6 is not 0, but not HI either.&lt;BR /&gt;&lt;BR /&gt;The question/requirement was&lt;BR /&gt;&lt;BR /&gt;"If the value of the 6th field is non zero"&lt;BR /&gt;&lt;BR /&gt;Cheers!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 31 Oct 2007 09:47:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094082#M310735</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-10-31T09:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094083#M310736</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Hein, there is a shorter solution:&lt;BR /&gt;awk '$6+0 {print $1}' file&lt;BR /&gt;and yes, no forced conversion to integer is needed, even this will work:&lt;BR /&gt;awk '$6 {print $1}' file&lt;BR /&gt;&lt;BR /&gt;The evaluation of $6 to TRUE will exactly succeed when the condition of Geoerge is met.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 31 Oct 2007 13:11:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4094083#M310736</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-10-31T13:11:54Z</dc:date>
    </item>
  </channel>
</rss>

