<?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: Comparision of two fields Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434347#M123971</link>
    <description>&lt;P&gt;Thankyou! This helps.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 06:38:16 GMT</pubDate>
    <dc:creator>megha0794</dc:creator>
    <dc:date>2019-08-08T06:38:16Z</dc:date>
    <item>
      <title>Comparision of two fields Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434343#M123967</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;Suppose I write a query and if say I have a field (A) and field (B)&lt;/P&gt;

&lt;P&gt;A         B&lt;BR /&gt;
1         1,3,4,5,8,9,10&lt;BR /&gt;
5         1,3,4,5,8,9,10&lt;BR /&gt;
7         1,3,4,5,8,9,10&lt;BR /&gt;
2         1,3,4,5,8,9,10&lt;/P&gt;

&lt;P&gt;I need to exclude all events where the values in A are a part of the comma separated values in B.&lt;BR /&gt;
In this case , results should display only where A= 7 and A=2&lt;/P&gt;

&lt;P&gt;Any help would be appreciated!&lt;BR /&gt;
Regards,&lt;BR /&gt;
Megha&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 06:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434343#M123967</guid>
      <dc:creator>megha0794</dc:creator>
      <dc:date>2019-08-07T06:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision of two fields Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434344#M123968</link>
      <description>&lt;P&gt;@megha0794 &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH | table A B
| eval  flag = mvfind(split(B,","),A)
| where isnull(flag)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My sample search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data="1|1,3,4,5,8,9,10&amp;amp;&amp;amp;5|1,3,4,5,8,9,10&amp;amp;&amp;amp;7|1,3,4,5,8,9,10&amp;amp;&amp;amp;2|1,3,4,5,8,9,10",data=split(data,"&amp;amp;&amp;amp;") 
| mvexpand data 
| eval A=mvindex(split(data,"|"),0),B=mvindex(split(data,"|"),1) 
| table A B
| eval  flag = mvfind(split(B,","),A)
| where isnull(flag)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/MultivalueEvalFunctions#mvfind.28MVFIELD.2C.22REGEX.22.29"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/MultivalueEvalFunctions#mvfind.28MVFIELD.2C.22REGEX.22.29&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 11:06:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434344#M123968</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-08-07T11:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision of two fields Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434345#M123969</link>
      <description>&lt;P&gt;Hi Megha,&lt;/P&gt;

&lt;P&gt;append your existing query with following,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval c = if(like(B,"%"+A+"%"),1,0) | where c=1 | fields A, B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will set value of field "C" to 1 only if A exists in B, than it will search for C=1&lt;/P&gt;

&lt;P&gt;Accept and upvote the answer if it helps.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 11:12:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434345#M123969</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-08-07T11:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision of two fields Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434346#M123970</link>
      <description>&lt;P&gt;Thankyou! This worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 06:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434346#M123970</guid>
      <dc:creator>megha0794</dc:creator>
      <dc:date>2019-08-08T06:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision of two fields Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434347#M123971</link>
      <description>&lt;P&gt;Thankyou! This helps.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 06:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434347#M123971</guid>
      <dc:creator>megha0794</dc:creator>
      <dc:date>2019-08-08T06:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision of two fields Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434348#M123972</link>
      <description>&lt;P&gt;Hi Gaurav,&lt;/P&gt;

&lt;P&gt;If say my field value in A does not exactly match with B , then is there a way we can compare and do a match?&lt;BR /&gt;
For eg: &lt;/P&gt;

&lt;P&gt;A&lt;BR /&gt;
1/text/text2.xlsx&lt;BR /&gt;
text1/10/text3.xlsx&lt;/P&gt;

&lt;P&gt;In both cases as '1' and '10' is a partial match to the comma separated values in B, so it needs to be excluded and say if I have a field value in A like the below - then it needs to be included:&lt;/P&gt;

&lt;P&gt;text5/7/text6.xlsx.&lt;/P&gt;

&lt;P&gt;In short the match can be in any portion of field A. The values in B will change dynamically and is pulled from lookup which gets appended over time. The ask is actually to compare all individual values in A with all the individual values in a field of the lookup. So in order to compare ,I am trying to merge all values of the field in the lookup and comma separate them to do a comparison with values in A. But the issue here is that the values in A will not be an exact match and there would be some extra text before of after the match. If there is some other way I can do a comparison, please do suggest.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;BR /&gt;
Megha&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 09:06:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparision-of-two-fields-Splunk/m-p/434348#M123972</guid>
      <dc:creator>megha0794</dc:creator>
      <dc:date>2019-10-11T09:06:58Z</dc:date>
    </item>
  </channel>
</rss>

