<?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: What can this sort command do? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533688#M890224</link>
    <description>Yes, it's ok.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;federico</description>
    <pubDate>Wed, 30 May 2001 05:10:24 GMT</pubDate>
    <dc:creator>federico_3</dc:creator>
    <dc:date>2001-05-30T05:10:24Z</dc:date>
    <item>
      <title>What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533682#M890218</link>
      <description>I saw a book cited an example as shown below,&lt;BR /&gt;#sort -t: +2n -3 /etc/passwd&lt;BR /&gt;&lt;BR /&gt;Can someone tell me how to interpret this?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!</description>
      <pubDate>Tue, 29 May 2001 06:22:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533682#M890218</guid>
      <dc:creator>Rashid Ali</dc:creator>
      <dc:date>2001-05-29T06:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533683#M890219</link>
      <description>&lt;BR /&gt;This sort command basically displays the passwd file sorted by UID (the 3rd field).&lt;BR /&gt;&lt;BR /&gt;The -t: command means use the colan as a field separator (instead of a space or tab), then the normal sort notation of +X -Y means to sort by fields X to Y, in this case 2 to 3 (the UID is the 3rd field in the passwd file after userid and password), so sort after 2 and until the 3rd field. The n on +2n means sort numerically (as opposed to alphabetically) as the UID field are numbers.&lt;BR /&gt;&lt;BR /&gt;See man on sort for more detailed info.&lt;BR /&gt;</description>
      <pubDate>Tue, 29 May 2001 06:45:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533683#M890219</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2001-05-29T06:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533684#M890220</link>
      <description>this command use with the t option as field separator ": ". The option +2n causes sort to skip the first 2 colomns and start to sort at the third field of each /etc/passwd line ( ID number) . -3 says that in case of equal third field, to put the first fields ( unix user ) in the right order.&lt;BR /&gt;&lt;BR /&gt;federico</description>
      <pubDate>Tue, 29 May 2001 07:14:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533684#M890220</guid>
      <dc:creator>federico_3</dc:creator>
      <dc:date>2001-05-29T07:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533685#M890221</link>
      <description>What's the difference between the previous command and "sort -t: +2n /etc/passwd" ?&lt;BR /&gt;I did a test and it seems getting the same result.</description>
      <pubDate>Tue, 29 May 2001 07:22:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533685#M890221</guid>
      <dc:creator>Rashid Ali</dc:creator>
      <dc:date>2001-05-29T07:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533686#M890222</link>
      <description>&lt;BR /&gt;there is no difference between +2n -3 or just using +2n. Just using +2n means do the sort calculation until the next field separator, which in this case is a colan so the result is the same. However, good practice is to use the full sort command format, field +X to -Y, if you use the sort command to sort other files you may need the -Y so good practicse is to use it.</description>
      <pubDate>Tue, 29 May 2001 07:59:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533686#M890222</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2001-05-29T07:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533687#M890223</link>
      <description>So sort -t: +3n -4 /etc/passwd will sort the file by Group id,right? But if I want to sort firstly by Group ID (primary key) and then  User id (secondary key), should I use &lt;BR /&gt; sort -t: -k 4n,4 -k 3n,3 /etc/passwd ?</description>
      <pubDate>Wed, 30 May 2001 00:25:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533687#M890223</guid>
      <dc:creator>Rashid Ali</dc:creator>
      <dc:date>2001-05-30T00:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: What can this sort command do?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533688#M890224</link>
      <description>Yes, it's ok.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;federico</description>
      <pubDate>Wed, 30 May 2001 05:10:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-can-this-sort-command-do/m-p/2533688#M890224</guid>
      <dc:creator>federico_3</dc:creator>
      <dc:date>2001-05-30T05:10:24Z</dc:date>
    </item>
  </channel>
</rss>

