<?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: How to write a search with the condition &amp;quot;if field1 NOT LIKE field2&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258070#M77305</link>
    <description>&lt;P&gt;Can you check the &lt;CODE&gt;match&lt;/CODE&gt; function here which might be what u r looking for:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/CommonEvalFunctions"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;OR few possible combinations for matching two fields are here&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/315143/how-to-search-a-field-for-text-from-another-field.html"&gt;https://answers.splunk.com/answers/315143/how-to-search-a-field-for-text-from-another-field.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Updating answer as per the comments&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | where NOT LIKE(Field1,"%".Field2."%") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search | where NOT match(Field1,".*".Field2.".*") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your base search | search Field1!=".*".Field2.".*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Nov 2016 01:41:38 GMT</pubDate>
    <dc:creator>gokadroid</dc:creator>
    <dc:date>2016-11-30T01:41:38Z</dc:date>
    <item>
      <title>How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258069#M77304</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I am aware of the following search syntax&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;field1 = *something*
field1 = field2
field1 != field2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I wish to write something like:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;field1 != *field2*&lt;/CODE&gt; but this is typically meant to search if field2 doesn't contain field1, but instead it's just searching field2 as text as it's set within asterisks.&lt;/P&gt;

&lt;P&gt;Can anyone provide me the syntax to search with this criteria? Thanks &lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 01:17:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258069#M77304</guid>
      <dc:creator>karthikmalla</dc:creator>
      <dc:date>2016-11-30T01:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258070#M77305</link>
      <description>&lt;P&gt;Can you check the &lt;CODE&gt;match&lt;/CODE&gt; function here which might be what u r looking for:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/CommonEvalFunctions"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;OR few possible combinations for matching two fields are here&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/315143/how-to-search-a-field-for-text-from-another-field.html"&gt;https://answers.splunk.com/answers/315143/how-to-search-a-field-for-text-from-another-field.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Updating answer as per the comments&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | where NOT LIKE(Field1,"%".Field2."%") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search | where NOT match(Field1,".*".Field2.".*") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your base search | search Field1!=".*".Field2.".*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Nov 2016 01:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258070#M77305</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-30T01:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258071#M77306</link>
      <description>&lt;P&gt;After much hair pulling with the trust (to be read as the last hour of my life), I've decided I'm going to share a custom spl command and instructions on how to use it.  In the morning though, not tonight.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 03:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258071#M77306</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-11-30T03:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258072#M77307</link>
      <description>&lt;P&gt;index=A | where like(Field, "%something%")&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 04:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258072#M77307</guid>
      <dc:creator>puneethgowda</dc:creator>
      <dc:date>2016-11-30T04:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258073#M77308</link>
      <description>&lt;P&gt;index=A  | where NOT like(field1, "%H%") &lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 04:03:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258073#M77308</guid>
      <dc:creator>puneethgowda</dc:creator>
      <dc:date>2016-11-30T04:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258074#M77309</link>
      <description>&lt;P&gt;@puneethgowda - I am not sure if you understood my question. I believe %something% and %H% will search something that's a static text, I need to search within a dynamic field. Can you please read my question once again? thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 04:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258074#M77309</guid>
      <dc:creator>karthikmalla</dc:creator>
      <dc:date>2016-11-30T04:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258075#M77310</link>
      <description>&lt;P&gt;Did u check the @somesoni2's answer in the second link i Posted. It has exactly what u need. Let me repaste his answer there, here too:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | where NOT LIKE(Field_A,"%".Field_B."%") 

 OR 

 Your base search | where NOT match(Field_A,".*".Field_B.".*") 

 OR 

 your base search | search Field_A!=".*".Field_B.".*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Nov 2016 04:51:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258075#M77310</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-30T04:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258076#M77311</link>
      <description>&lt;P&gt;Only this won't work if field2 has _ or %.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 09:40:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258076#M77311</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-11-30T09:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search with the condition "if field1 NOT LIKE field2"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258077#M77312</link>
      <description>&lt;P&gt;No one answered karthikmalla question. He wanted to to return or filter results where field1 is present NOT present within field2. An example of why this is necessary is when field 2 is an array. For example:&lt;/P&gt;

&lt;P&gt;Field1=1.1.1.1&lt;BR /&gt;
Field2= 1.1.1.1, 1.1.1.2, 1.1.1.3, 1.1.1.4&lt;/P&gt;

&lt;P&gt;So he needs to be able to search within Field2 and see if any of the values match the Field1 value or values.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 14:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-with-the-condition-quot-if-field1-NOT-LIKE/m-p/258077#M77312</guid>
      <dc:creator>yepyepyayyooo</dc:creator>
      <dc:date>2019-12-30T14:41:10Z</dc:date>
    </item>
  </channel>
</rss>

