<?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 create a true comparison where it matches values, and provides a percentage based on matches that are true? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/607777#M211340</link>
    <description>&lt;P class="lia-align-left"&gt;I've been comparing two lookup files, but its more pure arithmetic, where I am trying to implement a true comparison where it looks to match values, and provide a percentage based on which matches were true. So if I have three values in file1, and only two values match in file2, the percentage would equal to 66.6%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| inputlookup file1
| eventstats dc(Serial Number) as file1_Count
| dedup file1_Count
| inputlookup append=T file2
| eventstats dc(System Serial Number) as file2_Count
| dedup file2
| fields file1_Count,file2_Count
| eval percentage=round('file2_Count'/'file1_Count'*100,2)."%"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2022 20:03:45 GMT</pubDate>
    <dc:creator>Minasdad</dc:creator>
    <dc:date>2022-08-01T20:03:45Z</dc:date>
    <item>
      <title>How to create a true comparison where it matches values, and provides a percentage based on matches that are true?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/607777#M211340</link>
      <description>&lt;P class="lia-align-left"&gt;I've been comparing two lookup files, but its more pure arithmetic, where I am trying to implement a true comparison where it looks to match values, and provide a percentage based on which matches were true. So if I have three values in file1, and only two values match in file2, the percentage would equal to 66.6%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| inputlookup file1
| eventstats dc(Serial Number) as file1_Count
| dedup file1_Count
| inputlookup append=T file2
| eventstats dc(System Serial Number) as file2_Count
| dedup file2
| fields file1_Count,file2_Count
| eval percentage=round('file2_Count'/'file1_Count'*100,2)."%"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 20:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/607777#M211340</guid>
      <dc:creator>Minasdad</dc:creator>
      <dc:date>2022-08-01T20:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a true comparison where it matches values, and provide a percentage based on matches were  that are tr</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/607834#M211347</link>
      <description>&lt;P&gt;Consider writing a custom command in Python that accepts two lookup file names, compares them, and returns the percentage match in an output field.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 19:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/607834#M211347</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-08-01T19:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a true comparison where it matches values, and provides a percentage based on matches that are true?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/608146#M211452</link>
      <description>&lt;P&gt;Looking back at the question its not the result I truly want. I believe this is fairly simple but keeps slipping through my fingers.&amp;nbsp; File1.csv has a field of "Serial Number" and File2.csv has a field of "System Serial Number", all I want to do is compare and produce the results that do not match.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 17:30:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/608146#M211452</guid>
      <dc:creator>Minasdad</dc:creator>
      <dc:date>2022-08-03T17:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a true comparison where it matches values, and provides a percentage based on matches that are true?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/608151#M211454</link>
      <description>&lt;P&gt;Try this approach. Begin by reading one lookup file and marking the entries as "file1".&amp;nbsp; Then read in the other lookup file and mark the entries as "file2".&amp;nbsp; Rename the main column to match the first lookup.&amp;nbsp; Use the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command to merge the two result sets together, counting them by Serial Number.&amp;nbsp; Any entry with a count less than 2 means one of the lookups was missing that value.&amp;nbsp; The "file1" or "file2" mark will tell you which file has the value so it must be missing from the other one.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup file1
| eval src="file1"
| append [ | inputlookup file2
  | eval src="file2"
  | rename "System Serial Number" as "Serial Number"
]
| stats count, values(*) as * by 'Serial Number'
| where count &amp;lt; 2
| table "Serial Number" src&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 17:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-true-comparison-where-it-matches-values-and/m-p/608151#M211454</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-08-03T17:54:39Z</dc:date>
    </item>
  </channel>
</rss>

