<?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 by a certain pattern of  number occurring in a text? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609772#M212035</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248533"&gt;@Siva04&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2022 07:16:54 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-08-17T07:16:54Z</dc:date>
    <item>
      <title>How to sort by a certain pattern of  number occurring in a text?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609336#M211892</link>
      <description>&lt;P&gt;Hi, This is my first time starting a discussion. Please pardon my mistakes. So I am trying to perform a search where I can sort based&amp;nbsp; on a series of numbers occurring at the end of a text.&lt;/P&gt;
&lt;P&gt;example:&lt;/P&gt;
&lt;P&gt;index=abc sourcetype=xyz&amp;nbsp; Entity=HI* Text="*Rejected message received - code 456"&lt;/P&gt;
&lt;P&gt;index=abc sourcetype=xyz&amp;nbsp; Entity=HI* Text="*Rejected message received - code 789"&lt;/P&gt;
&lt;P&gt;index=abc sourcetype=xyz&amp;nbsp; Entity=HI* Text="*Rejected message received - code 345"&lt;/P&gt;
&lt;P&gt;So I would like to sort count by the&amp;nbsp; 3 digit&amp;nbsp;code number. Is it possible to do it?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 15:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609336#M211892</guid>
      <dc:creator>Siva04</dc:creator>
      <dc:date>2022-08-12T15:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by a certain pattern of  number occurring in a text?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609339#M211893</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248533"&gt;@Siva04&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry but your question isn't clear: if in a search you have one of the searches you shared all the values have the same Text, so it isn't possible to sort them.&lt;/P&gt;&lt;P&gt;Are the three searches in the same main search related by on "OR"?&lt;/P&gt;&lt;P&gt;If this is&amp;nbsp; your situation,. you can use the "sort" command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=xyz  Entity=HI* (Text="*Rejected message received - code 456" OR Text="*Rejected message received - code 789" OR Text="*Rejected message received - code 345")
| sort Text&lt;/LI-CODE&gt;&lt;P&gt;as you san see at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Sort" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Sort&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 15:36:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609339#M211893</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-12T15:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by a certain pattern of  number occurring in a text?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609353#M211895</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to say that I want to sort it by the code that differs with every text.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Text="*Rejected message received - code 456"&lt;/PRE&gt;&lt;P&gt;The * before the "Rejected message received " has a 6 digit number and when I do&amp;nbsp;&lt;BR /&gt;|stats count by Text&amp;nbsp;&lt;/P&gt;&lt;P&gt;it gives me the count based on the 6 digit number but instead I want it to give me count based on the code at the end of the Text. Since the code is not a field itself I am not able to do&lt;BR /&gt;|stats count by code&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 17:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609353#M211895</guid>
      <dc:creator>Siva04</dc:creator>
      <dc:date>2022-08-12T17:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by a certain pattern of  number occurring in a text?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609355#M211896</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248533"&gt;@Siva04&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;in this case, you have to extract the code field using a regex and use it for sorting, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=xyz  Entity=HI* (Text="*Rejected message received - code 456" OR Text="*Rejected message received - code 789" OR Text="*Rejected message received - code 345")
| rex field=Text "code\s+(?&amp;lt;code&amp;gt;\d+)$"
| stats values(code) AS code count by Text 
| sort code&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 17:18:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609355#M211896</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-12T17:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by a certain pattern of  number occurring in a text?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609678#M211997</link>
      <description>&lt;P&gt;Thank you it worked&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 16:33:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609678#M211997</guid>
      <dc:creator>Siva04</dc:creator>
      <dc:date>2022-08-16T16:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by a certain pattern of  number occurring in a text?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609772#M212035</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248533"&gt;@Siva04&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 07:16:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-a-certain-pattern-of-number-occurring-in-a-text/m-p/609772#M212035</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-17T07:16:54Z</dc:date>
    </item>
  </channel>
</rss>

