<?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: Extracting each value from a multi-valued field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220635#M64823</link>
    <description>&lt;P&gt;Thanks! This is what I was looking for.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Apr 2016 15:27:43 GMT</pubDate>
    <dc:creator>smhsplunk</dc:creator>
    <dc:date>2016-04-22T15:27:43Z</dc:date>
    <item>
      <title>Extracting each value from a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220632#M64820</link>
      <description>&lt;P&gt;I have a column with some information as follows&lt;/P&gt;

&lt;P&gt;traffic_location &lt;BR /&gt;
ABC 23 EFG RKY&lt;BR /&gt;
ABC 12 HIJ 23 &lt;BR /&gt;
ABD 23 HIJ 12&lt;BR /&gt;&lt;BR /&gt;
ABD 12 KYP 23 &lt;BR /&gt;
ABC 12 RMP 11&lt;/P&gt;

&lt;P&gt;This is a single column, the values inside this single column is separated by single spaces.&lt;BR /&gt;
I would like to access each of the 4 parts to put it in a dropdown menu, hence I need to access&lt;BR /&gt;
them individually, The values also have many duplicates, so I also want to remove the duplicate.&lt;BR /&gt;
So far I have this, but its returning me the entire row &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=traffic_information | search * traffic_location | fields traffic_location | dedup traffic_location | eval firstValue=split(traffic_location," ") | search firstValue=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The other I tried is this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=traffic_information | search * traffic_location | fields traffic_location | dedup traffic_location | rex "^(?&amp;lt;traffic_location&amp;gt;\w+)" | table traffic_location
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I am getting the entire column and not sure how to get the split parts, can we get eval from rex ?&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;

&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 15:11:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220632#M64820</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-04-22T15:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting each value from a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220633#M64821</link>
      <description>&lt;P&gt;If you know the order of your fields is always the same you could do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source=traffic_information 
| search * traffic_location 
| fields traffic_location 
| dedup traffic_location 
| eval traffic_location=split(traffic_location," ") 
| eval field1 = mvindex(traffic_location, 0)
| eval field2 = mvindex(traffic_location, 1)
| eval field3 = mvindex(traffic_location, 2)
| eval field4 = mvindex(traffic_location, 3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Apr 2016 15:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220633#M64821</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-04-22T15:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting each value from a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220634#M64822</link>
      <description>&lt;P&gt;You have couple of options&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;REX command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=traffic_information traffic_location=* | rex field=traffic_location "(?&amp;lt;f1&amp;gt;[^\s]+)\s(?&amp;lt;f2&amp;gt;[^\s]+)\s(?&amp;lt;f3&amp;gt;[^\s]+)\s(?&amp;lt;f4&amp;gt;[^\s]+))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Split command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=traffic_information traffic_location=* | eval temp=split(traffic_location ," ") | eval f1=mvindex(temp,0)| eval f2=mvindex(temp,1)| eval f3=mvindex(temp,2) | eval f4=mvindex(temp,4)  | fields - temp
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Apr 2016 15:21:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220634#M64822</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-22T15:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting each value from a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220635#M64823</link>
      <description>&lt;P&gt;Thanks! This is what I was looking for.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 15:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-each-value-from-a-multi-valued-field/m-p/220635#M64823</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-04-22T15:27:43Z</dc:date>
    </item>
  </channel>
</rss>

