<?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 can I split values based on two possible delimiters? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214074#M62788</link>
    <description>&lt;P&gt;Creative solution to make your search a lot less cluttered. &lt;/P&gt;</description>
    <pubDate>Tue, 14 Apr 2020 18:20:45 GMT</pubDate>
    <dc:creator>Yepeza</dc:creator>
    <dc:date>2020-04-14T18:20:45Z</dc:date>
    <item>
      <title>How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214067#M62781</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;    | eval field2=mvindex(split(word, " "),2) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I split based on either space " " or comma ","&lt;BR /&gt;
Beforehand, I do not know which delimiter will be there, so I want to use both.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:23:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214067#M62781</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-11-07T21:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214068#M62782</link>
      <description>&lt;P&gt;Why don't you rex the space into a comma first and then split on comma only:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base query to give you word
| rex mode=sed field=word "s/\ /,/g"
| split now on comma here
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:30:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214068#M62782</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-07T21:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214069#M62783</link>
      <description>&lt;P&gt;You can use makemv command with tokenizer option to achieve the same. Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search | eval field2=word | makemv tokenizer="(\w+)" field2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search | eval field2=word | makemv tokenizer="([^\s,]+)" field2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:19:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214069#M62783</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-11-07T22:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214070#M62784</link>
      <description>&lt;P&gt;You can try replace command on one of the delimiter fields and replace with other delimiter (in following case comma replaced with space) and then use single delimiter for split(in this case only delimiter will be space: &lt;/P&gt;

&lt;P&gt;your base search &lt;STRONG&gt;| eval word=replace(word,","," ") |&lt;/STRONG&gt; eval field2=mvindex(split(word, " "),2) &lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 05:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214070#M62784</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-08T05:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214071#M62785</link>
      <description>&lt;P&gt;This is how I wold do it.  You take the field where you have the &lt;CODE&gt;word&lt;/CODE&gt; and then split it inn to two new field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search | rex field=word "(?&amp;lt;field1&amp;gt;\w+)[\s,](?&amp;lt;field2&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you should have first part in &lt;CODE&gt;field1&lt;/CODE&gt; and second part in &lt;CODE&gt;field2&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 06:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214071#M62785</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-11-08T06:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214072#M62786</link>
      <description>&lt;P&gt;how can I skip a space  (if field2 is empty) and chose the next character , would I have to use if statement ?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 20:12:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214072#M62786</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-11-09T20:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214073#M62787</link>
      <description>&lt;P&gt;Can you give example of that word? If condition can definitely be used.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 21:41:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214073#M62787</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-09T21:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split values based on two possible delimiters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214074#M62788</link>
      <description>&lt;P&gt;Creative solution to make your search a lot less cluttered. &lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:20:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-values-based-on-two-possible-delimiters/m-p/214074#M62788</guid>
      <dc:creator>Yepeza</dc:creator>
      <dc:date>2020-04-14T18:20:45Z</dc:date>
    </item>
  </channel>
</rss>

