<?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 split single field value into two different values? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438658#M76473</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=Field0 "^(?&amp;lt;Field1&amp;gt;\d{2})(?&amp;lt;Field2&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 15 Jul 2018 14:48:20 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-07-15T14:48:20Z</dc:date>
    <item>
      <title>How to split single field value into two different values?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438655#M76470</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to split a single value of a result which is 5231562. I want to be able to split this number into two different values. &lt;/P&gt;

&lt;P&gt;i.e&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Field0 5231562 becomes -
Field1 = 52
Field2 = 31562
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jul 2018 08:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438655#M76470</guid>
      <dc:creator>alex389</dc:creator>
      <dc:date>2018-07-15T08:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to split single field value into two different values?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438656#M76471</link>
      <description>&lt;P&gt;@alex389 if you always want field1 to be first two digits you can write the following rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourCurrentSearch&amp;gt;
| rex field=field0 "^(?&amp;lt;field1&amp;gt;\d{2})(?&amp;lt;field2&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere search based on sample data and details.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval field0="5231562"
| rex field=field0 "^(?&amp;lt;field1&amp;gt;\d{2})(?&amp;lt;field2&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Jul 2018 12:19:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438656#M76471</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-15T12:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to split single field value into two different values?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438657#M76472</link>
      <description>&lt;P&gt;Hi @alex389,&lt;/P&gt;

&lt;P&gt;If you just want to split , you could use &lt;CODE&gt;substr&lt;/CODE&gt;. Lets know in case you need any logic for the first two digits&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count|fields - count|eval Field0=5231562|eval Field1=substr(Field0,0,2),Field2=substr(Field0,3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Jul 2018 12:19:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438657#M76472</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-15T12:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to split single field value into two different values?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438658#M76473</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=Field0 "^(?&amp;lt;Field1&amp;gt;\d{2})(?&amp;lt;Field2&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Jul 2018 14:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438658#M76473</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-15T14:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to split single field value into two different values?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438659#M76474</link>
      <description>&lt;P&gt;Thank you all&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 08:34:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438659#M76474</guid>
      <dc:creator>alex389</dc:creator>
      <dc:date>2018-07-16T08:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to split single field value into two different values?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438660#M76475</link>
      <description>&lt;P&gt;Don't forget to &lt;CODE&gt;UpVote&lt;/CODE&gt;, too!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 14:19:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-single-field-value-into-two-different-values/m-p/438660#M76475</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-16T14:19:23Z</dc:date>
    </item>
  </channel>
</rss>

