<?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 column in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624310#M104792</link>
    <description>Shiv ,&lt;BR /&gt;&lt;BR /&gt;# cat myfile | sort -k 2 &amp;gt; myfile2&lt;BR /&gt;# cat myfile2&lt;BR /&gt;&lt;BR /&gt;will sort for column 2 , with follwoing output :&lt;BR /&gt;&lt;BR /&gt;.812 10023870 modifyUser managed2&lt;BR /&gt;11.94 12690787 login managed4&lt;BR /&gt;6.009 6237126 migrateUser managed2&lt;BR /&gt;7.021 7127708 modifyUser managed4&lt;BR /&gt;7.741 7801930 modifyUser managed1&lt;BR /&gt;8.651 8900602 modifyUser managed2&lt;BR /&gt;$&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raj,</description>
    <pubDate>Tue, 13 Sep 2005 06:16:07 GMT</pubDate>
    <dc:creator>Raj D.</dc:creator>
    <dc:date>2005-09-13T06:16:07Z</dc:date>
    <item>
      <title>sorting column</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624306#M104788</link>
      <description>Dear Sirs,&lt;BR /&gt;&lt;BR /&gt;I want to sort out column1 or column2 in ascending or descending order in the below output. This outputs are stored in a text file.&lt;BR /&gt;&lt;BR /&gt;9.812 10023870 modifyUser managed2 &lt;BR /&gt;7.741 7801930   modifyUser managed1 &lt;BR /&gt;8.651 8900602  modifyUser managed2 &lt;BR /&gt;11.94 12690787 login  managed4 &lt;BR /&gt;7.021 7127708  modifyUser managed4 &lt;BR /&gt;6.009 6237126  migrateUser managed2 &lt;BR /&gt;&lt;BR /&gt;Can someone suggest combination of commands using grep, awk etc.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Sep 2005 00:17:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624306#M104788</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2005-09-13T00:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: sorting column</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624307#M104789</link>
      <description>&lt;BR /&gt;for sorting string-value wise, i.e., 11.94 is smaller than 6.00, the first character is what is important for sorting&lt;BR /&gt;&lt;BR /&gt;for column 1 &lt;BR /&gt;sort -k 1 myfile &amp;gt; mysortedfile_col1&lt;BR /&gt;&lt;BR /&gt;for column 2&lt;BR /&gt;sort -k 2 myfile &amp;gt; mysortedfile_col2&lt;BR /&gt;&lt;BR /&gt;to sort for the numeric value:&lt;BR /&gt;&lt;BR /&gt;sort -n -k 1 myfile &amp;gt; mysortedfile # sort acc to col 1 by numeric value&lt;BR /&gt;&lt;BR /&gt;to reverse the sorting order&lt;BR /&gt;&lt;BR /&gt;sort -rn -k 1 myfile &amp;gt; mysortedfile # sort acc to col 1 by numeric value in revrse order&lt;BR /&gt;&lt;BR /&gt;hope this helps&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Sep 2005 00:29:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624307#M104789</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-09-13T00:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: sorting column</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624308#M104790</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Assuming your data in file xyz.&lt;BR /&gt;&lt;BR /&gt;Just do&lt;BR /&gt;&lt;BR /&gt;# sort -k 2 &amp;lt; xyz|sort -k 1&lt;BR /&gt;&lt;BR /&gt;11.94 12690787 login managed4&lt;BR /&gt;6.009 6237126 migrateUser managed2&lt;BR /&gt;7.021 7127708 modifyUser managed4&lt;BR /&gt;7.741 7801930 modifyUser managed1&lt;BR /&gt;8.651 8900602 modifyUser managed2&lt;BR /&gt;9.812 10023870 modifyUser managed2&lt;BR /&gt;&lt;BR /&gt;If you want to sort in descending change the key option.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rajesh</description>
      <pubDate>Tue, 13 Sep 2005 00:30:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624308#M104790</guid>
      <dc:creator>Rajesh SB</dc:creator>
      <dc:date>2005-09-13T00:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: sorting column</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624309#M104791</link>
      <description>Use the -r option for sorting descending.&lt;BR /&gt;&lt;BR /&gt;sort -r&lt;BR /&gt;&lt;BR /&gt;Plus if you want unique options there is the -u tag.</description>
      <pubDate>Tue, 13 Sep 2005 03:11:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624309#M104791</guid>
      <dc:creator>Vibhor Kumar Agarwal</dc:creator>
      <dc:date>2005-09-13T03:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: sorting column</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624310#M104792</link>
      <description>Shiv ,&lt;BR /&gt;&lt;BR /&gt;# cat myfile | sort -k 2 &amp;gt; myfile2&lt;BR /&gt;# cat myfile2&lt;BR /&gt;&lt;BR /&gt;will sort for column 2 , with follwoing output :&lt;BR /&gt;&lt;BR /&gt;.812 10023870 modifyUser managed2&lt;BR /&gt;11.94 12690787 login managed4&lt;BR /&gt;6.009 6237126 migrateUser managed2&lt;BR /&gt;7.021 7127708 modifyUser managed4&lt;BR /&gt;7.741 7801930 modifyUser managed1&lt;BR /&gt;8.651 8900602 modifyUser managed2&lt;BR /&gt;$&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raj,</description>
      <pubDate>Tue, 13 Sep 2005 06:16:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624310#M104792</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2005-09-13T06:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: sorting column</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624311#M104793</link>
      <description>Hi Shiv,&lt;BR /&gt;&lt;BR /&gt;sort -k 2 &lt;INPUT file="" /&gt;|sort -k 1 -r -o &lt;OUTPUT file=""&gt;&lt;BR /&gt;&lt;BR /&gt;This will sort by column 2 in asceding order and column 1 in descening order. Result in &lt;OUTPUR file=""&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art&lt;/OUTPUR&gt;&lt;/OUTPUT&gt;</description>
      <pubDate>Wed, 14 Sep 2005 07:02:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sorting-column/m-p/3624311#M104793</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2005-09-14T07:02:27Z</dc:date>
    </item>
  </channel>
</rss>

