<?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 How do you join two fields with dedup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-join-two-fields-with-dedup/m-p/377096#M110647</link>
    <description>&lt;P&gt;Hello folks, &lt;/P&gt;

&lt;P&gt;Trying to figure out how to go about joining 2 fields with a dash but only if they don't have the same values.  Ideally, if there's a way to dynamically add the - only if 2 strings, that would cool!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;string1 string2 string3
string10 string20 string20
string11 string100 string100

index=xyz sourcetype=zzz |table field1 field2 field3
    |eval joined = field2 + " - " + field3
|table field1 joined
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results desired for joined field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    string1 string2 - string3
    string10 string20
    string11 string100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Feb 2019 15:54:11 GMT</pubDate>
    <dc:creator>splunker1981</dc:creator>
    <dc:date>2019-02-08T15:54:11Z</dc:date>
    <item>
      <title>How do you join two fields with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-join-two-fields-with-dedup/m-p/377096#M110647</link>
      <description>&lt;P&gt;Hello folks, &lt;/P&gt;

&lt;P&gt;Trying to figure out how to go about joining 2 fields with a dash but only if they don't have the same values.  Ideally, if there's a way to dynamically add the - only if 2 strings, that would cool!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;string1 string2 string3
string10 string20 string20
string11 string100 string100

index=xyz sourcetype=zzz |table field1 field2 field3
    |eval joined = field2 + " - " + field3
|table field1 joined
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results desired for joined field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    string1 string2 - string3
    string10 string20
    string11 string100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 15:54:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-join-two-fields-with-dedup/m-p/377096#M110647</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2019-02-08T15:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you join two fields with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-join-two-fields-with-dedup/m-p/377097#M110648</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=xyz sourcetype=zzz | eval joined=if((field2!=field3), field2 . "-" . field3, null())
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 16:02:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-join-two-fields-with-dedup/m-p/377097#M110648</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-08T16:02:04Z</dc:date>
    </item>
  </channel>
</rss>

