<?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: Dedup multiple fields into one list in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491194#M137143</link>
    <description>&lt;P&gt;@skirven, Use foreach loop.&lt;BR /&gt;
For example below-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval scn01="abc", scn02="bcd", scn10="ddd", scn14="ert",total="" | foreach scn* [eval total= total." &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"]|makemv total delim=" "|mvexpand total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 12 Mar 2020 11:31:18 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2020-03-12T11:31:18Z</dc:date>
    <item>
      <title>Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491193#M137142</link>
      <description>&lt;P&gt;Hi! I'm trying to create a search that would return unique values in a record, but in one list.&lt;/P&gt;

&lt;P&gt;The search &lt;CODE&gt;"basesearch | table scn*"&lt;/CODE&gt; would come up with a table where I have values across scn01 to scn20. So what I want to do is make a unique list of values combined into one column, of all of the fields values. I don't need to preserve the previous field name. &lt;/P&gt;

&lt;P&gt;How might I do that?&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Stephen&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:16:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491193#M137142</guid>
      <dc:creator>skirven</dc:creator>
      <dc:date>2020-03-12T11:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491194#M137143</link>
      <description>&lt;P&gt;@skirven, Use foreach loop.&lt;BR /&gt;
For example below-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval scn01="abc", scn02="bcd", scn10="ddd", scn14="ert",total="" | foreach scn* [eval total= total." &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"]|makemv total delim=" "|mvexpand total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:31:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491194#M137143</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2020-03-12T11:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491195#M137144</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Check this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval scn01=23,scn02=34,scn03=55 
| append 
    [| makeresults 
    | eval scn01=34,scn02=34,scn03=55] 
| eval temp="" 
| foreach scn* 
    [ eval temp=temp ." ". &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;] 
| makemv temp 
| stats values(temp) as result delim="," 
| nomv result
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491195#M137144</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-03-12T11:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491196#M137145</link>
      <description>&lt;P&gt;hi @skirven,&lt;BR /&gt;
Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch | eval scn_combine = "" | fillnull value="" | foreach scn* [eval scn_combine=scn_combine." ".'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'] | table scn_combine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want scn_combine as multivalue field then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basesearch | eval scn_combine = "" | fillnull value="" | foreach scn* [eval scn_combine=scn_combine." ".'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'] | makemv  scn_combine | table scn_combine
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491196#M137145</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-12T11:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491197#M137146</link>
      <description>&lt;P&gt;Hmmm... This gets me closer, but nothing's quite right yet.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval scn_combine = "" | fillnull value="" | foreach scn* [append scn_combine scn*] | table scn_combine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see the point about looping through scn(x). But I'm thinking I want to append the values to a temp table, then running another dedup on that temp table? This search tossed an error.&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Stephen&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:54:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491197#M137146</guid>
      <dc:creator>skirven</dc:creator>
      <dc:date>2020-03-12T11:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491198#M137147</link>
      <description>&lt;P&gt;Use &lt;CODE&gt;transpose&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search&amp;gt;
| table scn*
| stats values(row1) as SCNs
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 13:48:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491198#M137147</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2020-03-12T13:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491199#M137148</link>
      <description>&lt;P&gt;This gets me closer, but it's dropping all of the values into one row. I wanted to get them all in different rows, so that I could run the dedup again to get unique values. &lt;BR /&gt;
-Stephen&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 07:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491199#M137148</guid>
      <dc:creator>skirven</dc:creator>
      <dc:date>2020-03-13T07:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491200#M137149</link>
      <description>&lt;P&gt;This might work for what I need anyway. I was hoping to get them all in one table list, but my ultimate goal was to get it to send to a API via the JSON endpoint, so one string in that may be OK. But I couldn't get makeenv to split the values back into a list by rows.&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Stephen&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 07:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491200#M137149</guid>
      <dc:creator>skirven</dc:creator>
      <dc:date>2020-03-13T07:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491201#M137150</link>
      <description>&lt;P&gt;AHA! &lt;CODE&gt;mvexpand&lt;/CODE&gt;!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  table scn*
 | eval temp="" 
 | foreach scn* 
     [ eval temp=temp ." ". &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;] 
 | makemv temp 
 | stats values(temp) as result delim="," 
 | makemv delim="," result
 | mvexpand result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks everyone!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 08:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491201#M137150</guid>
      <dc:creator>skirven</dc:creator>
      <dc:date>2020-03-13T08:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dedup multiple fields into one list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491202#M137151</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval scn01=23,scn02=34,scn03=55 
| append 
    [| makeresults 
    | eval scn01=34,scn02=34,scn03=55] 
| eval temp="" 
| foreach scn* 
    [ eval temp=temp ." ". &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;] 
| makemv temp 
| stats values(temp) as result 
| mvexpand result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;values() - Returns the list of all distinct values&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 08:07:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dedup-multiple-fields-into-one-list/m-p/491202#M137151</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-03-13T08:07:13Z</dc:date>
    </item>
  </channel>
</rss>

