<?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: Simple awk problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814438#M827952</link>
    <description>To be honest, Jim's was the "better" solution, as you should always take advantage of a command's capabilities to open a file rather than use cat/pipe and therefore waste a process.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
    <pubDate>Fri, 27 Sep 2002 11:45:03 GMT</pubDate>
    <dc:creator>Robin Wakefield</dc:creator>
    <dc:date>2002-09-27T11:45:03Z</dc:date>
    <item>
      <title>Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814431#M827945</link>
      <description>I have a file with many lines and each line has variable number of fields.  I always need the next to last field for a report.  How can I get the next to last field of each line in variable fields line.</description>
      <pubDate>Thu, 26 Sep 2002 20:08:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814431#M827945</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2002-09-26T20:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814432#M827946</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try this way&lt;BR /&gt;&lt;BR /&gt;cat file|awk '{print $(NF-1)}'&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 26 Sep 2002 20:14:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814432#M827946</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-09-26T20:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814433#M827947</link>
      <description>NF is number of fields on the record. You can then do the following-&lt;BR /&gt;&lt;BR /&gt;awk '{NN=NF-1; print $NN}' yourfile&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 20:15:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814433#M827947</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-26T20:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814434#M827948</link>
      <description>Hi James:&lt;BR /&gt;&lt;BR /&gt;# awk '{print $(NF-1)}' filename&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;# echo "1 2 3\na b\nh e l l o !"|awk '{print $(NF-1)}'&lt;BR /&gt;&lt;BR /&gt;...prints:&lt;BR /&gt;&lt;BR /&gt;2&lt;BR /&gt;a&lt;BR /&gt;o&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Sep 2002 20:15:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814434#M827948</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-26T20:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814435#M827949</link>
      <description>Thanks for the quick reply and they both work, 10 points to the first and 9 for the others.</description>
      <pubDate>Thu, 26 Sep 2002 20:20:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814435#M827949</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2002-09-26T20:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814436#M827950</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Do you *really* consider the timestamps of the three replies to differ?&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Sep 2002 20:23:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814436#M827950</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-26T20:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814437#M827951</link>
      <description>Ah come on Jim, I gave you 9 points even though your answer was the same Sridhar.  At least I give points to everyone that responds.  I see a lot of responses where there is none or just to one.  I even assign points that do not even come close to the subject.</description>
      <pubDate>Fri, 27 Sep 2002 11:27:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814437#M827951</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2002-09-27T11:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814438#M827952</link>
      <description>To be honest, Jim's was the "better" solution, as you should always take advantage of a command's capabilities to open a file rather than use cat/pipe and therefore waste a process.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Fri, 27 Sep 2002 11:45:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814438#M827952</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-09-27T11:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814439#M827953</link>
      <description>Robin, your are correct, but I wasn't using the cat in my process, it was at the end of a ps command that was piped into grep -v |piped into a sort and then finally the awk to print the next to last field.</description>
      <pubDate>Fri, 27 Sep 2002 15:38:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814439#M827953</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2002-09-27T15:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814440#M827954</link>
      <description>I often use awk as receiver to commands and that sense was carried in the post too.&lt;BR /&gt;&lt;BR /&gt;Since you mentioned that you had the file, JRF's solution stands as the most correct one though this is all about the idea of using NF-1. &lt;BR /&gt;&lt;BR /&gt;With the time stamps, you can understand that everyone responded at the same time and that's what JRF was mentioning about.&lt;BR /&gt;&lt;BR /&gt;You are appreciated for your promptness in assigning the points.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Fri, 27 Sep 2002 16:34:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-problem/m-p/2814440#M827954</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-09-27T16:34:17Z</dc:date>
    </item>
  </channel>
</rss>

