<?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: Comparing two files and output the difference for one column in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362186#M163020</link>
    <description>&lt;P&gt;here how result Pass has been calculated?&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 16:22:07 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-02-08T16:22:07Z</dc:date>
    <item>
      <title>Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362184#M163018</link>
      <description>&lt;P&gt;Hope you can help !&lt;/P&gt;

&lt;P&gt;I have two CSV files: RESULTS1  and  RESULTS2&lt;/P&gt;

&lt;P&gt;RESULTS1 has two columns&lt;/P&gt;

&lt;P&gt;CAR                   TOTAL&lt;BR /&gt;
Vauxhall           25&lt;BR /&gt;
BMW                30&lt;BR /&gt;
Mercedes        50&lt;/P&gt;

&lt;P&gt;RESULTS2 has several columns…&lt;/P&gt;

&lt;P&gt;DATE        TIME    CAR     NUMBER&lt;BR /&gt;
00/00/2018  00:00   Ford        10&lt;BR /&gt;
00/00/2018  00:00   Vauxhall            20&lt;BR /&gt;
00/00/2018  00:00   Renault     12&lt;BR /&gt;
00/00/2018  00:00   BMW     10&lt;BR /&gt;
00/00/2018  00:00   Mercedes    25&lt;/P&gt;

&lt;P&gt;The output I would like to see is…  so basically comparing column CAR and outputting the difference...&lt;/P&gt;

&lt;P&gt;CAR             RESULT&lt;BR /&gt;
Ford        Pass&lt;BR /&gt;
Renault     Pass&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362184#M163018</guid>
      <dc:creator>Derben</dc:creator>
      <dc:date>2018-02-08T16:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362185#M163019</link>
      <description>&lt;P&gt;This will be pretty easy, but first - what determines "PASS"? Is it only if a car is present in RESULTS2 but not in RESULTS1? Or are you actually comparing the NUMBER/TOTAL fields somehow?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362185#M163019</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-08T16:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362186#M163020</link>
      <description>&lt;P&gt;here how result Pass has been calculated?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362186#M163020</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-08T16:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362187#M163021</link>
      <description>&lt;P&gt;If you're just looking for values of &lt;CODE&gt;CAR&lt;/CODE&gt; that are present in RESULTS2 but not in RESULTS1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup RESULTS2
| lookup RESULTS1 CAR OUTPUT CAR AS car_found
| where isnull(car_found)
| eval RESULT="Pass"
| fields CAR RESULT
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:23:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362187#M163021</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-08T16:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362188#M163022</link>
      <description>&lt;P&gt;hi @Derben ,&lt;BR /&gt;
can you please provide more details about how you comparing two lookup files which gives you pass/ fail result?&lt;BR /&gt;
And also your sample search if any..&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362188#M163022</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-02-08T16:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362189#M163023</link>
      <description>&lt;P&gt;Basically, just need the difference in the CAR column...&lt;/P&gt;

&lt;P&gt;CAR &lt;BR /&gt;
Ford &lt;BR /&gt;
Renault &lt;/P&gt;

&lt;P&gt;i.e. the two cars missing from RESULTS1&lt;/P&gt;

&lt;P&gt;Tried the inputlookup in various guises but keep getting "Invalid argument: CAR"  Can't seem to get it to recognize the CAR column in the csv files?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362189#M163023</guid>
      <dc:creator>Derben</dc:creator>
      <dc:date>2018-02-09T14:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362190#M163024</link>
      <description>&lt;P&gt;Could you provide what query you have tried?&lt;BR /&gt;
As below answer seems to be working... &lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:38:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362190#M163024</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-09T14:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362191#M163025</link>
      <description>&lt;P&gt;Perhaps you could copy and paste to us the result of the following two queries, run separately:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup RESULTS1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup RESULTS2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This may help us diagnose the problem in the SPL syntax.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362191#M163025</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-09T14:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362192#M163026</link>
      <description>&lt;P&gt;Mmm, that could be my problem.  Created a new App which contains the two .csv files as 'sourcetype'&lt;/P&gt;

&lt;P&gt;inputlookup RESULTS1 or 2 doesn't return anything back when run in that App  ????&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 15:30:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362192#M163026</guid>
      <dc:creator>Derben</dc:creator>
      <dc:date>2018-02-09T15:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362193#M163027</link>
      <description>&lt;P&gt;I'm adding this as an answer so that I can include some screenshots. Based on your comments, it sounds like you don't have these files  uploaded as lookup files, which is getting in the way. So let's take it down to basics. Start by ensuring you have two files on your local computer. One is named RESULTS1.csv and the other is named RESULTS2.csv. Now we need to upload those two files into Splunk. &lt;/P&gt;

&lt;P&gt;First, go to &lt;CODE&gt;Settings &amp;gt; Lookups&lt;/CODE&gt;. From the menu that loads, click on "Add New" for Lookup Files, as identified in this screenshot:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4327iB7DB7C7EB10F63C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;From the next menu, select the destination app for your CSV file. You mentioned you'd created an app for this, so select that app from the dropdown. (I redacted my app name in the screenshot.) Use the "Choose File" button to locate RESULTS1.csv on your computer. In the "Destination filename" field, enter &lt;CODE&gt;RESULTS1.csv&lt;/CODE&gt;. Here's the menu you'll be using for this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4328iC3DCFECF2B26C1A0/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
Repeat these steps to upload RESULTS2.csv. &lt;/P&gt;

&lt;P&gt;Now run this query from within your app:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup RESULTS2.csv
| lookup RESULTS1.csv CAR OUTPUT CAR AS car_found
| where isnull(car_found)
| eval RESULT="Pass"
| fields CAR RESULT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you don't get the results you're seeking, then the lookup files probably are not formatted as you thought. To test that, you can run the following commands:&lt;BR /&gt;
    | inputlookup RESULTS1.csv&lt;/P&gt;

&lt;P&gt;and then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup RESULTS2.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you still need help after following these instructions, please copy and paste the results of those two &lt;CODE&gt;inputlookup&lt;/CODE&gt; searches, and we'll get you sorted out.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 16:54:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362193#M163027</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-09T16:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files and output the difference for one column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362194#M163028</link>
      <description>&lt;P&gt;Please see the instructions I posted below as a new answer. Hopefully, we can get you on the same page as we expect, and then the SPL syntax work will be a breeze. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 16:54:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-files-and-output-the-difference-for-one-column/m-p/362194#M163028</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-09T16:54:53Z</dc:date>
    </item>
  </channel>
</rss>

