<?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 to compare a field value with next whole column and fetch the result in next column? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405199#M190903</link>
    <description>&lt;P&gt;for example,&lt;/P&gt;

&lt;P&gt;Col A          Col B            Col C&lt;BR /&gt;
apple          apple            apple&lt;BR /&gt;
orange         apple            orange&lt;BR /&gt;
pineapple     orange        pineapple&lt;BR /&gt;
grapes         pineapple    grapes&lt;BR /&gt;
banana          grapes            null&lt;BR /&gt;
kiwi                   cucumber null&lt;BR /&gt;
mango          radish            null&lt;/P&gt;

&lt;P&gt;I have a data in column A and Column B , apple in ColA should compare with whole ColB , once the data is identified should fetch the data and results in ColC&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 08:01:49 GMT</pubDate>
    <dc:creator>afrinakaffrey</dc:creator>
    <dc:date>2019-07-24T08:01:49Z</dc:date>
    <item>
      <title>how to compare a field value with next whole column and fetch the result in next column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405199#M190903</link>
      <description>&lt;P&gt;for example,&lt;/P&gt;

&lt;P&gt;Col A          Col B            Col C&lt;BR /&gt;
apple          apple            apple&lt;BR /&gt;
orange         apple            orange&lt;BR /&gt;
pineapple     orange        pineapple&lt;BR /&gt;
grapes         pineapple    grapes&lt;BR /&gt;
banana          grapes            null&lt;BR /&gt;
kiwi                   cucumber null&lt;BR /&gt;
mango          radish            null&lt;/P&gt;

&lt;P&gt;I have a data in column A and Column B , apple in ColA should compare with whole ColB , once the data is identified should fetch the data and results in ColC&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 08:01:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405199#M190903</guid>
      <dc:creator>afrinakaffrey</dc:creator>
      <dc:date>2019-07-24T08:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare a field value with next whole column and fetch the result in next column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405200#M190904</link>
      <description>&lt;P&gt;@afrinakaffrey ,&lt;/P&gt;

&lt;P&gt;try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search |eventstats values(ColB) as colBList
|eval colC=if(isnotnull(mvfind(colBList,ColA )),ColA ,null())
| fields - colBList
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 13:12:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405200#M190904</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-07-24T13:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare a field value with next whole column and fetch the result in next column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405201#M190905</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="dummydata.csv" host="ind1" sourcetype="csv" 
| rename "Col A" as A, "Col B" as B 
| table A,B,temp 
| stats list(A) as A,list(B) as B,list(temp) as temp 
| eval tempB=mvjoin(B,",") 
| eval AandB =mvzip(A,B,"#") 
| table AandB tempB 
| mvexpand AandB 
| eval tempAandB=split(AandB,"#") 
| eval A=mvindex(tempAandB,0),B=mvindex(tempAandB,1) 
| table A,B,tempB 
| eval C=if(in(A,'tempB'),A,null()) 
| makemv tempB delim="," 
| eval C=if(mvfind(tempB, 'A')&amp;gt;0,A,null()) 
| table A,B,C
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Data used:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Col A,Col B
apple,apple
orange,apple
pineapple,orange
grapes,pineapple
banana,grapes
kiwi,cucumber
mango,radish
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://i.ibb.co/Z1CWNgG/comapre.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 14:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-a-field-value-with-next-whole-column-and-fetch/m-p/405201#M190905</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-07-24T14:21:59Z</dc:date>
    </item>
  </channel>
</rss>

