<?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 via multiple keyfields in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708098#M903646</link>
    <description>Hi Boyd,&lt;BR /&gt;&lt;BR /&gt;Try redirecting the output of the first sort into the second, as follows:&lt;BR /&gt;&lt;BR /&gt;`ls | sort -n -t. | sort -n -t. +1` &lt;BR /&gt;&lt;BR /&gt;This uses both the sorts you have already tried, but combining them together.&lt;BR /&gt;&lt;BR /&gt;I'll try it later today and let you know how it goes....&lt;BR /&gt;&lt;BR /&gt;John</description>
    <pubDate>Mon, 22 Apr 2002 13:18:12 GMT</pubDate>
    <dc:creator>John Strang</dc:creator>
    <dc:date>2002-04-22T13:18:12Z</dc:date>
    <item>
      <title>sort via multiple keyfields</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708097#M903645</link>
      <description>Trying to sort the following listing (ls):&lt;BR /&gt;&lt;BR /&gt;file1.10&lt;BR /&gt;file1.11&lt;BR /&gt;file1.8&lt;BR /&gt;file1.9&lt;BR /&gt;file2.1&lt;BR /&gt;file2.10&lt;BR /&gt;file2.2&lt;BR /&gt;file2.3&lt;BR /&gt;file3.1&lt;BR /&gt;file3.10&lt;BR /&gt;file3.2&lt;BR /&gt;&lt;BR /&gt;so the result is:&lt;BR /&gt;&lt;BR /&gt;file1.8&lt;BR /&gt;file1.9&lt;BR /&gt;file1.10&lt;BR /&gt;file1.11&lt;BR /&gt;file2.1&lt;BR /&gt;file2.2&lt;BR /&gt;file2.3&lt;BR /&gt;file2.10&lt;BR /&gt;file3.1&lt;BR /&gt;file3.2&lt;BR /&gt;file3.10&lt;BR /&gt;&lt;BR /&gt;Already tried `ls | sort -n -t.` which sorts the first&lt;BR /&gt;field only and `ls | sort -n -t. +1` which sorts the second field only.&lt;BR /&gt;&lt;BR /&gt;Also tried `ls | sort -n -t. -k 1,2` which sorts the &lt;BR /&gt;second field only.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;&lt;BR /&gt;Boy</description>
      <pubDate>Mon, 22 Apr 2002 13:01:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708097#M903645</guid>
      <dc:creator>Boyd Kodama</dc:creator>
      <dc:date>2002-04-22T13:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: sort via multiple keyfields</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708098#M903646</link>
      <description>Hi Boyd,&lt;BR /&gt;&lt;BR /&gt;Try redirecting the output of the first sort into the second, as follows:&lt;BR /&gt;&lt;BR /&gt;`ls | sort -n -t. | sort -n -t. +1` &lt;BR /&gt;&lt;BR /&gt;This uses both the sorts you have already tried, but combining them together.&lt;BR /&gt;&lt;BR /&gt;I'll try it later today and let you know how it goes....&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Mon, 22 Apr 2002 13:18:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708098#M903646</guid>
      <dc:creator>John Strang</dc:creator>
      <dc:date>2002-04-22T13:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: sort via multiple keyfields</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708099#M903647</link>
      <description>This should do it:&lt;BR /&gt;&lt;BR /&gt;cat myfile | sort -t '.' -k 1,1b -k 2,2n &amp;gt; newfile</description>
      <pubDate>Mon, 22 Apr 2002 13:22:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708099#M903647</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-04-22T13:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: sort via multiple keyfields</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708100#M903648</link>
      <description>Thanks Clay.  Yours worked.&lt;BR /&gt;&lt;BR /&gt;Sorry John, the second `sort`&lt;BR /&gt;re-sorts the whole list according to the second field.&lt;BR /&gt;&lt;BR /&gt;Boyd</description>
      <pubDate>Mon, 22 Apr 2002 13:33:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708100#M903648</guid>
      <dc:creator>Boyd Kodama</dc:creator>
      <dc:date>2002-04-22T13:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: sort via multiple keyfields</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708101#M903649</link>
      <description>Hi Boyd,&lt;BR /&gt;&lt;BR /&gt;Apologies for posting an incorrect solution - I'd not considered the fact that the second sort would re-sort the whole list :-(&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Mon, 22 Apr 2002 14:08:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sort-via-multiple-keyfields/m-p/2708101#M903649</guid>
      <dc:creator>John Strang</dc:creator>
      <dc:date>2002-04-22T14:08:59Z</dc:date>
    </item>
  </channel>
</rss>

