<?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 divide a value from a string into fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582943#M202999</link>
    <description>&lt;P&gt;Assuming the type is always 2 uppercase alphabet characters:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=value "\s(?&amp;lt;_raw&amp;gt;([A-Z]{2}\,\d{5}\;)+([A-Z]{2}\,\d{5})?)"
| extract kvdelim="," pairdelim=";" 
| transpose | regex column="[A-Z]{2}"
| rename column AS Type "row 1" AS count 
| eval count=tonumber(count)
| table Type count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can substitute with this regex to extract the pattern from your raw data instead of the field value -- test to see which works better.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\s(?&amp;lt;_raw&amp;gt;([A-Z]{2}\,\d{5}\;)+([A-Z]{2}\,\d{5})?)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jan 2022 16:17:13 GMT</pubDate>
    <dc:creator>johnhuang</dc:creator>
    <dc:date>2022-01-28T16:17:13Z</dc:date>
    <item>
      <title>How to divide a value from a string into fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582912#M202990</link>
      <description>&lt;P&gt;I have value in field:&lt;/P&gt;&lt;P&gt;value: 10,5 CC,00136;CY,00004;JE,00004;QK,00004&lt;BR /&gt;&lt;BR /&gt;Where&amp;nbsp; CC,CY,JE - type message and&amp;nbsp;there are more of them than in example&lt;/P&gt;&lt;P&gt;00136,00004 - number of message&lt;/P&gt;&lt;P&gt;But I need to get table:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Type&lt;/TD&gt;&lt;TD width="50%"&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;CC&lt;/TD&gt;&lt;TD width="50%"&gt;136&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;CY&lt;/TD&gt;&lt;TD width="50%"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JE&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i do it with SPL language?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 11:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582912#M202990</guid>
      <dc:creator>Luninho</dc:creator>
      <dc:date>2022-01-28T11:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide a value from a string into fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582917#M202992</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226837"&gt;@Luninho&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;are the types in fixed positions?&lt;/P&gt;&lt;P&gt;if they are in fixed posiztion (e.g. 1st, 3rd 5th position) or identificable e.g. for a newar char (e.g. ; just before), you can create a regex to extract them, otherwise it's very difficoult.&lt;/P&gt;&lt;P&gt;Cold you share some additional samples?&lt;/P&gt;&lt;P&gt;From the one you shared the only rule I can identify is that there's a comma just after, it always has a two upper char.&lt;/P&gt;&lt;P&gt;If this is correct you could creat a regex like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "(\s|;)(?&amp;lt;Type&amp;gt;\w\w),"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/GuqZpU/1" target="_blank"&gt;https://regex101.com/r/GuqZpU/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 11:37:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582917#M202992</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-01-28T11:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide a value from a string into fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582943#M202999</link>
      <description>&lt;P&gt;Assuming the type is always 2 uppercase alphabet characters:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=value "\s(?&amp;lt;_raw&amp;gt;([A-Z]{2}\,\d{5}\;)+([A-Z]{2}\,\d{5})?)"
| extract kvdelim="," pairdelim=";" 
| transpose | regex column="[A-Z]{2}"
| rename column AS Type "row 1" AS count 
| eval count=tonumber(count)
| table Type count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can substitute with this regex to extract the pattern from your raw data instead of the field value -- test to see which works better.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\s(?&amp;lt;_raw&amp;gt;([A-Z]{2}\,\d{5}\;)+([A-Z]{2}\,\d{5})?)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 16:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-divide-a-value-from-a-string-into-fields/m-p/582943#M202999</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-01-28T16:17:13Z</dc:date>
    </item>
  </channel>
</rss>

