<?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: How to tell the sort command to sort by numerical order instead of lexigraphical? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67303#M16828</link>
    <description>&lt;P&gt;Hi , &lt;/P&gt;

&lt;P&gt;Hope you have got answer by now for this issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;I came across this same issue today and got solution for it , Hence posting so that it can help others similar issue . &lt;/P&gt;

&lt;P&gt;This sort is not going to work if you use stats , timechart , &lt;BR /&gt;
use chart instead , Both fields and sort will work seamlessly.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Razal &lt;/P&gt;</description>
    <pubDate>Wed, 12 Mar 2014 04:59:51 GMT</pubDate>
    <dc:creator>russel_mohammed</dc:creator>
    <dc:date>2014-03-12T04:59:51Z</dc:date>
    <item>
      <title>How to tell the sort command to sort by numerical order instead of lexigraphical?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67300#M16825</link>
      <description>&lt;P&gt;I want the series to sort as 1,2,3,10,11,12 not 1,10,11,12,2,3.  The sort functions do not seem to have any effect when used in this context:&lt;/P&gt;

&lt;P&gt;... | sort -num(myfield)&lt;/P&gt;

&lt;P&gt;I don't see any examples of using the sort functions in the documentation or other questions.  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I have also tried:&lt;/P&gt;

&lt;P&gt;... | sort by num(myfield)&lt;BR /&gt;&lt;BR /&gt;
   ... | sort num(myfield)&lt;/P&gt;

&lt;P&gt;Halp!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2011 22:09:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67300#M16825</guid>
      <dc:creator>hulahoop</dc:creator>
      <dc:date>2011-08-30T22:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell the sort command to sort by numerical order instead of lexigraphical?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67301#M16826</link>
      <description>&lt;P&gt;i'm not sure why this isn't working for you. it seems to be fine for me...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | sort +|- num(&amp;lt;numeric field&amp;gt;)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;did you have a particular search/example that wasn't working? i can help you with that and perhaps add that as an example to the topic. thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2011 23:29:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67301#M16826</guid>
      <dc:creator>sophy</dc:creator>
      <dc:date>2011-08-30T23:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell the sort command to sort by numerical order instead of lexigraphical?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67302#M16827</link>
      <description>&lt;P&gt;You can also use the fields command to specify the fields.&lt;/P&gt;

&lt;P&gt;| fields "column1" col2 col3 col4&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2012 07:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67302#M16827</guid>
      <dc:creator>brettcave</dc:creator>
      <dc:date>2012-06-27T07:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell the sort command to sort by numerical order instead of lexigraphical?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67303#M16828</link>
      <description>&lt;P&gt;Hi , &lt;/P&gt;

&lt;P&gt;Hope you have got answer by now for this issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;I came across this same issue today and got solution for it , Hence posting so that it can help others similar issue . &lt;/P&gt;

&lt;P&gt;This sort is not going to work if you use stats , timechart , &lt;BR /&gt;
use chart instead , Both fields and sort will work seamlessly.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Razal &lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2014 04:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67303#M16828</guid>
      <dc:creator>russel_mohammed</dc:creator>
      <dc:date>2014-03-12T04:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to tell the sort command to sort by numerical order instead of lexigraphical?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67304#M16829</link>
      <description>&lt;P&gt;I was able to use the convert num(string) which converts the given value to a number and then use the sort command on this &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;somesearch that generates the stats name ,myEventCount |convert num(myEventCount) as nummyEventCount|sort -nummyEventCount|table name nummyEventCount&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sun, 08 May 2016 05:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-tell-the-sort-command-to-sort-by-numerical-order-instead/m-p/67304#M16829</guid>
      <dc:creator>sunilsk1</dc:creator>
      <dc:date>2016-05-08T05:36:55Z</dc:date>
    </item>
  </channel>
</rss>

