<?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: get the single value out of multiple in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96737#M25025</link>
    <description>&lt;P&gt;You can do this by turning the Location into a multivalued field,  and then using &lt;CODE&gt;stats values&lt;/CODE&gt; to get only the distinct values for each Name.   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search here&amp;gt; | eval Location=split(Location,",") | stats values(Location) as Location by Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This makes a couple assumptions -- each Name value only appears in one row in your search results, and the comma character never makes an appearance in your &lt;EM&gt;actual&lt;/EM&gt; Location values. &lt;/P&gt;</description>
    <pubDate>Sun, 21 Oct 2012 04:56:33 GMT</pubDate>
    <dc:creator>sideview</dc:creator>
    <dc:date>2012-10-21T04:56:33Z</dc:date>
    <item>
      <title>get the single value out of multiple</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96732#M25020</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the input like this :&lt;/P&gt;

&lt;P&gt;Name    Location&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;abhay     kol,mumbai,kol&lt;BR /&gt;
murari    mumbai,chennai&lt;BR /&gt;
trid      delhi,delhi&lt;BR /&gt;
xyz       haridwar&lt;/P&gt;

&lt;P&gt;My output should be like :&lt;/P&gt;

&lt;P&gt;Name    Location&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;abhay     kol,mumbai&lt;BR /&gt;
murari    mumbai,chennai&lt;BR /&gt;
trid      delhi&lt;BR /&gt;
xyz       haridwar&lt;/P&gt;

&lt;P&gt;If any double data is there in Location filed then it should be removed, I want to display only single value !!&lt;/P&gt;

&lt;P&gt;Please help !!&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Abhay&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 19:33:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96732#M25020</guid>
      <dc:creator>abhayneilam</dc:creator>
      <dc:date>2012-10-19T19:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: get the single value out of multiple</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96733#M25021</link>
      <description>&lt;P&gt;Could you please also post&lt;/P&gt;

&lt;P&gt;a) some sample events&lt;BR /&gt;
b) the search that produces the first table&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 20:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96733#M25021</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-10-19T20:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: get the single value out of multiple</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96734#M25022</link>
      <description>&lt;P&gt;Ok, another off the cuff search.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
...| makemv delim="," Location | dedup Location |  eval Location =mvjoin(Location ,",") | table Name, Location&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;or &lt;BR /&gt;
&lt;CODE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
...| makemv delim="," Location | dedup Location |  eval Location=if(Name=Name,mvjoin(Location ,","),Location) | table Name, Location&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 20:22:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96734#M25022</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2012-10-19T20:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: get the single value out of multiple</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96735#M25023</link>
      <description>&lt;P&gt;This is my search: &lt;/P&gt;

&lt;P&gt;index="maa" | rex max_match=9999  field="Location" (?&lt;ONE&gt;(?i)"(delhi|mumbai|kol|bu is)")|eval final=mvjoin(ONE,",")| table Name Age Location final | sort final + desc&lt;/ONE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 20:29:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96735#M25023</guid>
      <dc:creator>abhayneilam</dc:creator>
      <dc:date>2012-10-19T20:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: get the single value out of multiple</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96736#M25024</link>
      <description>&lt;P&gt;my input has some blank value also in the Location field:&lt;/P&gt;

&lt;P&gt;Name    Location&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;abhay   kol,mumbai,kol&lt;BR /&gt;
murari  mumbai,chennai&lt;BR /&gt;
trid    delhi,delhi&lt;BR /&gt;
xyz haridwar&lt;BR /&gt;
abc &lt;BR /&gt;
mno &lt;/P&gt;

&lt;P&gt;my output should be like this :&lt;/P&gt;

&lt;P&gt;Name    Location&lt;BR /&gt;
abhay   kol,mumbai&lt;BR /&gt;
murari  mumbai,chennai&lt;BR /&gt;
trid    delhi&lt;BR /&gt;
xyz haridwar&lt;BR /&gt;
abc &lt;BR /&gt;
mno&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 20:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96736#M25024</guid>
      <dc:creator>abhayneilam</dc:creator>
      <dc:date>2012-10-19T20:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: get the single value out of multiple</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96737#M25025</link>
      <description>&lt;P&gt;You can do this by turning the Location into a multivalued field,  and then using &lt;CODE&gt;stats values&lt;/CODE&gt; to get only the distinct values for each Name.   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search here&amp;gt; | eval Location=split(Location,",") | stats values(Location) as Location by Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This makes a couple assumptions -- each Name value only appears in one row in your search results, and the comma character never makes an appearance in your &lt;EM&gt;actual&lt;/EM&gt; Location values. &lt;/P&gt;</description>
      <pubDate>Sun, 21 Oct 2012 04:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-the-single-value-out-of-multiple/m-p/96737#M25025</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2012-10-21T04:56:33Z</dc:date>
    </item>
  </channel>
</rss>

