<?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: gawk asort function in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260104#M687891</link>
    <description>&lt;!--!*#--&gt;I have no problems with gawk 3.1.4 and numeric values with asort.  Provided the values weren't in quotes to start:&lt;BR /&gt;gawk '&lt;BR /&gt;BEGIN {&lt;BR /&gt;   s[10] = 2&lt;BR /&gt;   s[11] = 1&lt;BR /&gt;   s[12] = 3&lt;BR /&gt;   s[13] = 10&lt;BR /&gt;   asort(s)&lt;BR /&gt;   print s[1]&lt;BR /&gt;   print s[2]&lt;BR /&gt;   print s[3]&lt;BR /&gt;   print s[4]&lt;BR /&gt;   for (i in s)&lt;BR /&gt;      print i, s[i]&lt;BR /&gt;   exit&lt;BR /&gt;}' /dev/null</description>
    <pubDate>Fri, 29 Aug 2008 02:35:32 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-08-29T02:35:32Z</dc:date>
    <item>
      <title>gawk asort function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260103#M687890</link>
      <description>Hi, I google a bit but couldn't find what I need. Hope some expert can help me.&lt;BR /&gt;&lt;BR /&gt;I have an array stored with numeric data, however when I call the asort(array) function, The sorted array is based on string comparision (1, 10, 11, 2, 20, 3, 4,5 ..). How do I sort in numeric order (1,2,3,4,...), I need to do this in gawk.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Aug 2008 01:39:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260103#M687890</guid>
      <dc:creator>OTii</dc:creator>
      <dc:date>2008-08-29T01:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: gawk asort function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260104#M687891</link>
      <description>&lt;!--!*#--&gt;I have no problems with gawk 3.1.4 and numeric values with asort.  Provided the values weren't in quotes to start:&lt;BR /&gt;gawk '&lt;BR /&gt;BEGIN {&lt;BR /&gt;   s[10] = 2&lt;BR /&gt;   s[11] = 1&lt;BR /&gt;   s[12] = 3&lt;BR /&gt;   s[13] = 10&lt;BR /&gt;   asort(s)&lt;BR /&gt;   print s[1]&lt;BR /&gt;   print s[2]&lt;BR /&gt;   print s[3]&lt;BR /&gt;   print s[4]&lt;BR /&gt;   for (i in s)&lt;BR /&gt;      print i, s[i]&lt;BR /&gt;   exit&lt;BR /&gt;}' /dev/null</description>
      <pubDate>Fri, 29 Aug 2008 02:35:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260104#M687891</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-08-29T02:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: gawk asort function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260105#M687892</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Perl offers the ability to sort in numeric versus alphabetic order merely by switching to the "spaceship" operator from the 'cmp' operator.  Consider:&lt;BR /&gt;&lt;BR /&gt;# perl -le '@n=qw(2 1 3 10);print for sort {$a &amp;lt;=&amp;gt; $b} @n'&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;10&lt;BR /&gt;&lt;BR /&gt;...instead of:&lt;BR /&gt;&lt;BR /&gt;# perl -le '@n=qw(2 1 3 10);print for sort {$a cmp $b} @n'&lt;BR /&gt;1&lt;BR /&gt;10&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;&lt;BR /&gt;...As you see, Perl would have solved a problem that forced you to move from 'awk' to 'gawk' anyway :-}}&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1262693" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1262693&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Aug 2008 12:15:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gawk-asort-function/m-p/4260105#M687892</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-08-29T12:15:19Z</dc:date>
    </item>
  </channel>
</rss>

