<?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: sorting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472642#M775677</link>
    <description>JRF,&lt;BR /&gt;&lt;BR /&gt;I want to include in the output the top 3 lines. Your solution exlucdes the top lines from the output,</description>
    <pubDate>Mon, 11 Dec 2000 19:33:34 GMT</pubDate>
    <dc:creator>Leslie Chaim</dc:creator>
    <dc:date>2000-12-11T19:33:34Z</dc:date>
    <item>
      <title>sorting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472640#M775675</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to sort the output of a given command. However, I wish to exclude the first 3 lines from the sort.&lt;BR /&gt;&lt;BR /&gt;Is there an elegant way of doing this without going through the hassle of temporary files?&lt;BR /&gt;&lt;BR /&gt;currently I use something like this:&lt;BR /&gt;&lt;BR /&gt;my_app $* &amp;gt; /tmp/my_app.$$          &lt;BR /&gt;head -2 /tmp/my_app.$$&lt;BR /&gt;sed -n '3,$p' /tmp/my_app.$$ | sort&lt;BR /&gt;rm /tmp/my_app.$$&lt;BR /&gt;&lt;BR /&gt;I am wondering if there is something more elegant&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Dec 2000 18:56:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472640#M775675</guid>
      <dc:creator>Leslie Chaim</dc:creator>
      <dc:date>2000-12-11T18:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: sorting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472641#M775676</link>
      <description>Leslie:&lt;BR /&gt;&lt;BR /&gt;Try:&lt;BR /&gt;&lt;BR /&gt;# my_app | awk 'NR &amp;gt; 3 {print $0}' | sort&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 11 Dec 2000 19:07:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472641#M775676</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-12-11T19:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: sorting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472642#M775677</link>
      <description>JRF,&lt;BR /&gt;&lt;BR /&gt;I want to include in the output the top 3 lines. Your solution exlucdes the top lines from the output,</description>
      <pubDate>Mon, 11 Dec 2000 19:33:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472642#M775677</guid>
      <dc:creator>Leslie Chaim</dc:creator>
      <dc:date>2000-12-11T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: sorting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472643#M775678</link>
      <description>Try this way&lt;BR /&gt;# my_app | awk 'NR &amp;lt;= 3 {print $0}' &amp;gt;only_one_file&lt;BR /&gt;&lt;BR /&gt;## my_app | awk 'NR &amp;gt; 3 {print $0}' | sort -o only_one_file &lt;BR /&gt;&lt;BR /&gt;This way you have only one file created at any time. &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Madhu</description>
      <pubDate>Mon, 11 Dec 2000 19:56:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472643#M775678</guid>
      <dc:creator>Madhu Sudhan_1</dc:creator>
      <dc:date>2000-12-11T19:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: sorting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472644#M775679</link>
      <description>Leslie:&lt;BR /&gt;&lt;BR /&gt;OK, I assume you want to take the output of your process and sort it, but you do not want to include the first three lines of output in the sort -- as in the case of a table with a header.  Therefore, consider this example:&lt;BR /&gt;&lt;BR /&gt;Given a file that looks like:&lt;BR /&gt;&lt;BR /&gt;1a&lt;BR /&gt;2b&lt;BR /&gt;3c&lt;BR /&gt;4c&lt;BR /&gt;5e&lt;BR /&gt;6f&lt;BR /&gt;7g&lt;BR /&gt;&lt;BR /&gt;# cat my_file|awk '{if (NR &amp;lt;=3) {print $0} else {print $0|"sort -r"}}'&lt;BR /&gt;&lt;BR /&gt;would produce output ordered:&lt;BR /&gt;&lt;BR /&gt;1a&lt;BR /&gt;2b&lt;BR /&gt;3c&lt;BR /&gt;7g&lt;BR /&gt;6f&lt;BR /&gt;5e&lt;BR /&gt;4d&lt;BR /&gt;&lt;BR /&gt;No temporary files would be used; the first three lines would pass "unsorted", and in this example (clearly) the remaining lines would be sorted (here in reverse).&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 11 Dec 2000 21:28:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472644#M775679</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-12-11T21:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: sorting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472645#M775680</link>
      <description>JRF,&lt;BR /&gt;&lt;BR /&gt;That does solve my problem. I am just wondering how does awk pass the data to the sort command?&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Dec 2000 22:14:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sorting/m-p/2472645#M775680</guid>
      <dc:creator>Leslie Chaim</dc:creator>
      <dc:date>2000-12-11T22:14:40Z</dc:date>
    </item>
  </channel>
</rss>

