{"id":60330,"date":"2022-07-11T12:57:19","date_gmt":"2022-07-11T12:57:19","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=60330"},"modified":"2022-07-11T12:57:19","modified_gmt":"2022-07-11T12:57:19","slug":"answer-by-warren-for-compare-two-product-lists-in-splunk","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=60330","title":{"rendered":"Answer by warren for Compare two product lists in splunk"},"content":{"rendered":"<p>If these are two lookup files, you can do an <code>| inputlookup<\/code> followed by a <code>| lookup<\/code> like this:<\/p>\n<pre><code>| inputlookup firstlookup.csv\n| lookup secondlookup.csv title\n<\/code><\/pre>\n<p>Everywhere they have a match, the lookup will output the matching columns<\/p>\n<p>Say your first table has columns <code>title, price, location<\/code>, and the second has <code>title, author, pub_date<\/code><\/p>\n<p>For every entry in the first table where you have a matching <code>title<\/code>, you&#8217;ll get the <code>author<\/code> and <code>pub_date<\/code><\/p>\n<p>For every entry that <em>doesn&#8217;t<\/em> match, you&#8217;ll get null value for <code>author<\/code> and <code>pub_date<\/code><\/p>\n<p>Your result will look something like this:<\/p>\n<pre><code>title   | price    | location   | author    | pub_date\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nBookA   | 17       | Riyadh     | Jones     | 2022\nToyC    | 79       | Cairo      |           |\nBookQ   | 28       | Monrovia   | Sayid     | 2005\n<\/code><\/pre>\n<p>If you want to filter out the items that don&#8217;t match, add <code>| where isnotnull(author)<\/code> (using the example field names in this answer)<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/72935596\/compare-two-product-lists-in-splunk\/72938972#72938972<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If these are two lookup files, you can do an | inputlookup followed by a | lookup like this: | inputlookup firstlookup.csv | lookup secondlookup.csv title Everywhere they have a match, the lookup will output the matching columns Say your first table has columns title, price, location, and the second has title, author, pub_date For &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=60330\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for Compare two product lists in splunk<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[991],"keyring_services":[],"class_list":["post-60330","post","type-post","status-publish","format-standard","hentry","category-blih","tag-stackexchange"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/60330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=60330"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/60330\/revisions"}],"predecessor-version":[{"id":60331,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/60330\/revisions\/60331"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60330"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=60330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}