<?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 data from two files and showing the results. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65501#M16268</link>
    <description>&lt;P&gt;I'm assuming each line in a file is one event in Splunk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="file1*" OR source="file2*" | eventstats count by _raw | where count = 1 AND match(source,"file1")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Dec 2012 08:06:18 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2012-12-17T08:06:18Z</dc:date>
    <item>
      <title>Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65500#M16267</link>
      <description>&lt;P&gt;I have two files with a simple list of filenames in each. What I'd like to do is to compare one file to the other and remove any thing in the first file if it appears in the second; for example-&lt;BR /&gt;
File 1&lt;BR /&gt;
foo.exe&lt;BR /&gt;
bar.exe&lt;BR /&gt;
car.exe&lt;BR /&gt;
dar.exe&lt;/P&gt;

&lt;P&gt;File 2&lt;BR /&gt;
car.exe&lt;BR /&gt;
dar.exe&lt;BR /&gt;
smar.exe&lt;/P&gt;

&lt;P&gt;My desired output would be:&lt;BR /&gt;
foo.exe&lt;BR /&gt;
bar.exe&lt;/P&gt;

&lt;P&gt;as I am trying to use File 2 as a sort of whitelist and filter File 1 through it. Is this even possible? Any help would be greatly appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 07:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65500#M16267</guid>
      <dc:creator>malag_doval</dc:creator>
      <dc:date>2012-12-17T07:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65501#M16268</link>
      <description>&lt;P&gt;I'm assuming each line in a file is one event in Splunk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="file1*" OR source="file2*" | eventstats count by _raw | where count = 1 AND match(source,"file1")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Dec 2012 08:06:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65501#M16268</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-12-17T08:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65502#M16269</link>
      <description>&lt;P&gt;Thanks for your help, I've replaced "fileX" for my file names and run the query but it doesn't produce any outputs. PS, each line in the source files is it's own event, you're correct.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 08:48:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65502#M16269</guid>
      <dc:creator>malag_doval</dc:creator>
      <dc:date>2012-12-17T08:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65503#M16270</link>
      <description>&lt;P&gt;Does the query without the where command produce outputs?&lt;/P&gt;

&lt;P&gt;What's your modified query, and your source field contents?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 10:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65503#M16270</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-12-17T10:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65504#M16271</link>
      <description>&lt;P&gt;The query does indeed produce something when I strip off the WHERE command. My query string is thus:&lt;/P&gt;

&lt;P&gt;source="c:\splunk data\difffile1.csv*" OR source="c:\splunk data\difffile2.csv*" | eventstats count by _raw | where count = 1 AND match (source, "c:\splunk data\difffile1.csv"&lt;/P&gt;

&lt;P&gt;Thanks again for working this through with me, I very much appreciate it!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:58:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65504#M16271</guid>
      <dc:creator>malag_doval</dc:creator>
      <dc:date>2020-09-28T12:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65505#M16272</link>
      <description>&lt;P&gt;Note, the second argument to match() is treated as a regular expression. Writing "\s" causes the matcher to look for a space, while "\d" will look for a digit. You will have to escape the backslashes like so: "\\"&lt;/P&gt;

&lt;P&gt;The lazy would just write match(source, "difffile1") &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 19:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65505#M16272</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-12-17T19:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65506#M16273</link>
      <description>&lt;P&gt;Ahh yes, I did have the double \'s in but thismorning when I was setting it up again I neglected to put those in sorry.&lt;/P&gt;

&lt;P&gt;I also tried to move the WHICH statement as apart of the search statement, since splunk was very insistant about combining the two together but it didnt make any difference.&lt;/P&gt;

&lt;P&gt;One other thing I just realised - I am running an old version; I will update immediately and try it again, this might be an issue as well. :&amp;lt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 19:48:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65506#M16273</guid>
      <dc:creator>malag_doval</dc:creator>
      <dc:date>2012-12-17T19:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65507#M16274</link>
      <description>&lt;P&gt;So you get results after the eventstats but nothing after the where?&lt;/P&gt;

&lt;P&gt;There's only two things that can go wrong, and they're unrelated to the version. Either the count filters out everything - then the pre-where results have no events with count=1, or the match filters out everything - then the matching against the source file name doesn't work.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 20:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65507#M16274</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-12-17T20:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from two files and showing the results.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65508#M16275</link>
      <description>&lt;P&gt;OK it turns out you were spot on with that query, I recreated the data sets and imported them again and it worked first shot. It must have had something to do with the method of importing data; All I know is that I'm happy I can continue on now so thank you very much Martin &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2012 21:20:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-two-files-and-showing-the-results/m-p/65508#M16275</guid>
      <dc:creator>malag_doval</dc:creator>
      <dc:date>2012-12-17T21:20:35Z</dc:date>
    </item>
  </channel>
</rss>

