<?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: Sort Problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151583#M900992</link>
    <description>Have you tried adding in the -n option for numeric sorting, rather than the standard lexicographical sort order?&lt;BR /&gt;</description>
    <pubDate>Tue, 23 Dec 2003 08:07:38 GMT</pubDate>
    <dc:creator>melvyn burnard</dc:creator>
    <dc:date>2003-12-23T08:07:38Z</dc:date>
    <item>
      <title>Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151580#M900989</link>
      <description>We are sorting the file a.lst using the&lt;BR /&gt;following command (Sorting on 2 and 3 rd columns only)&lt;BR /&gt;sort -t':' -k2,3 a.lst&lt;BR /&gt;&lt;BR /&gt;cat a.lst&lt;BR /&gt;&lt;BR /&gt;1:3:3:4&lt;BR /&gt;1:4:3:5&lt;BR /&gt;1:2:3:4&lt;BR /&gt;1:5:3:4&lt;BR /&gt;1:4:3:4&lt;BR /&gt;&lt;BR /&gt;The output we are getting is&lt;BR /&gt;1:2:3:4&lt;BR /&gt;1:3:3:4&lt;BR /&gt;1:4:3:4&lt;BR /&gt;1:4:3:5&lt;BR /&gt;1:5:3:4&lt;BR /&gt;                  &lt;BR /&gt;The output we are expecting is :&lt;BR /&gt;1:2:3:4&lt;BR /&gt;1:3:3:4&lt;BR /&gt;1:4:3:5&lt;BR /&gt;1:4:3:4&lt;BR /&gt;1:5:3:4&lt;BR /&gt;&lt;BR /&gt;Can anyone suggest us a solution.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 23 Dec 2003 07:47:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151580#M900989</guid>
      <dc:creator>C Kishore</dc:creator>
      <dc:date>2003-12-23T07:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151581#M900990</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;can you explain, why you want to sort column 4 in reverse order?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael</description>
      <pubDate>Tue, 23 Dec 2003 07:52:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151581#M900990</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-23T07:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151582#M900991</link>
      <description>We are not sorting column 4 in reverse order,&lt;BR /&gt;our intention is to sort on cloumns 2 and 3 only. In the above example 1:4:3:5 preceeds&lt;BR /&gt;1:4:3:4, so we are expecting the same order.</description>
      <pubDate>Tue, 23 Dec 2003 08:04:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151582#M900991</guid>
      <dc:creator>C Kishore</dc:creator>
      <dc:date>2003-12-23T08:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151583#M900992</link>
      <description>Have you tried adding in the -n option for numeric sorting, rather than the standard lexicographical sort order?&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Dec 2003 08:07:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151583#M900992</guid>
      <dc:creator>melvyn burnard</dc:creator>
      <dc:date>2003-12-23T08:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151584#M900993</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I often use nl to play this kind of games ...&lt;BR /&gt;&lt;BR /&gt;nl -s: a.lst | sort -b -t':' -k3,4n -k1,1n | cut -f2- -d:&lt;BR /&gt;&lt;BR /&gt;In this case it add temporarily a new sort field to keep trace of the original order which is not garanted on non sorted fields.&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Dec 2003 08:13:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151584#M900993</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-12-23T08:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151585#M900994</link>
      <description>Most SORT programs will produce that same result. Column 2 contains a colon, for all records. If you sorted a.lst on column 2 only you should find it is already in sort-order, but the sequence of records would be unchanged. &lt;BR /&gt;&lt;BR /&gt;The output you are getting is in sort-order for a sort on columns 2 and 3 -- you told the sort to not look at the columns after column 3, so for this sort, 1:4:3:4 and 1:4:3:5 are identical. The 1:4:3:5 preceeds in the output because it was encountered first in the input, and when the sort encountered an identical record (":4") you had defined no reason for it to change their order. To produce the output you desire, sort on columns 1 through 7 -- ie: the full length of the strings being sorted.</description>
      <pubDate>Thu, 25 Dec 2003 10:36:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151585#M900994</guid>
      <dc:creator>ranthony2cfl.rr.com</dc:creator>
      <dc:date>2003-12-25T10:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151586#M900995</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Jean-Louis has the perfect answer. I was thinking to programme something like this, but seeing, that he was there before, I did not try to post a slightly different version. Take it, it works!!&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Dec 2003 12:33:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-problem/m-p/3151586#M900995</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-25T12:33:32Z</dc:date>
    </item>
  </channel>
</rss>

