<?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 sort alphanumeric values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361250#M166478</link>
    <description>&lt;P&gt;Thanks a lot for your help! I have successfully  sorted the alphanumeric field by copying/pasting the expression.&lt;/P&gt;

&lt;P&gt;I don't have past experience of writing expressions and I am having trouble understanding what does the  expressions means. Would you mind explaining what "(?\d+)"  states?  Sorry for being such a noob.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 01:31:20 GMT</pubDate>
    <dc:creator>auaave</dc:creator>
    <dc:date>2017-08-11T01:31:20Z</dc:date>
    <item>
      <title>How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361246#M166474</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;How can I sort the below alphanumeric values?&lt;/P&gt;

&lt;P&gt;From            To&lt;BR /&gt;
ROBOT 1 ROBOT 1&lt;BR /&gt;
ROBOT 10    ROBOT 2&lt;BR /&gt;
ROBOT 2 ROBOT 3&lt;BR /&gt;
ROBOT 3 ROBOT 4&lt;BR /&gt;
ROBOT 4 ROBOT 5&lt;BR /&gt;
ROBOT 5 ROBOT 6&lt;BR /&gt;
ROBOT 6 ROBOT 7&lt;BR /&gt;
ROBOT 7 ROBOT 8&lt;BR /&gt;
ROBOT 8 ROBOT 9&lt;BR /&gt;
ROBOT 9 ROBOT 10&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 02:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361246#M166474</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2017-08-10T02:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361247#M166475</link>
      <description>&lt;P&gt;I'm going to assume you want them sorted numerically by &lt;STRONG&gt;From&lt;/STRONG&gt; based on your data?&lt;/P&gt;

&lt;P&gt;you'll want to create a separate field that has just the numeric values, OR that puts the numeric values in front of the string but has leading zeros (001 ROBOT)&lt;/P&gt;

&lt;P&gt;this will create a new field for the &lt;STRONG&gt;From&lt;/STRONG&gt; numbers &lt;CODE&gt;|rex field=From "(?&amp;lt;FromNum&amp;gt;\d+)"&lt;/CODE&gt; and you can then sort from that field and then remove it if you wish using &lt;CODE&gt;|sort FromNum |fields - FromNum&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;if you want to put the leading zero number in front of the string (my example below gives 3 digit numbers, so it would be 001...020...100..), you could try: &lt;CODE&gt;|rex field=From "(?&amp;lt;FromText&amp;gt;\w+)\s(?&amp;lt;FromNum&amp;gt;\d+)" |eval FromNum=substr("000".FromNum,-3)|eval From=FromNum." ".FromText|sort FromNum|fields - FromNum&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 11:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361247#M166475</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T11:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361248#M166476</link>
      <description>&lt;P&gt;@cmerriman - Plus for good answer.  Also note that the number doesn't have to be on the front.  Sort works just as well with "Robot 001".&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 15:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361248#M166476</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-10T15:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361249#M166477</link>
      <description>&lt;P&gt;That's a good point. Though, with numbers in front, it would sort "001 AAA", "001 AAB", "002 AAA"... and with them at the end it would sort "AAA 001", "AAA 002", "AAB 001".... just depends what is more important in this case, alphanumeric sorting or numericalpha sorting.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361249#M166477</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T16:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361250#M166478</link>
      <description>&lt;P&gt;Thanks a lot for your help! I have successfully  sorted the alphanumeric field by copying/pasting the expression.&lt;/P&gt;

&lt;P&gt;I don't have past experience of writing expressions and I am having trouble understanding what does the  expressions means. Would you mind explaining what "(?\d+)"  states?  Sorry for being such a noob.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 01:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361250#M166478</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2017-08-11T01:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361251#M166479</link>
      <description>&lt;P&gt;It's alright. The &lt;CODE&gt;&amp;lt;...&amp;gt;&lt;/CODE&gt; creates a naming group (like a field name) and the &lt;CODE&gt;\d+&lt;/CODE&gt; looks for any digit. &lt;CODE&gt;\w+&lt;/CODE&gt; is any non-digit. If you go to regex101.com you can type in the string you need to parse and test regex statements and it will explain what it's doing. It's a great resource. &lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 02:00:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361251#M166479</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-11T02:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort alphanumeric values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361252#M166480</link>
      <description>&lt;P&gt;Awesome! I will definitely check the site. &lt;BR /&gt;
Thanks a lot! &lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 02:05:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-alphanumeric-values/m-p/361252#M166480</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2017-08-11T02:05:43Z</dc:date>
    </item>
  </channel>
</rss>

