<?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 Build an If Statement based on if a field contains a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297917#M89862</link>
    <description>&lt;P&gt;thank you this works!&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2018 19:21:36 GMT</pubDate>
    <dc:creator>katzr</dc:creator>
    <dc:date>2018-01-08T19:21:36Z</dc:date>
    <item>
      <title>How to Build an If Statement based on if a field contains a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297915#M89860</link>
      <description>&lt;P&gt;For every record where the field Test contains the word "Please" - I want to replace the string with "This is a test", below is the logic I am applying and it is not working- I tried using case, like, and a changed from " to ' and = to == but I cannot get anything to work. &lt;/P&gt;

&lt;P&gt;| eval Test=if(Test=="&lt;EM&gt;Please&lt;/EM&gt;", "This is a test", Test) &lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 19:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297915#M89860</guid>
      <dc:creator>katzr</dc:creator>
      <dc:date>2018-01-08T19:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Build an If Statement based on if a field contains a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297916#M89861</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval Test=if(match(Test,"Please"),"This is a test", Test)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The equal sign does the exact comparison (value should match exactly). Since you want to check for "contains", you can use &lt;CODE&gt;match(Test,"Please")&lt;/CODE&gt; or &lt;CODE&gt;like(Test,"%Please%")&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 19:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297916#M89861</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-01-08T19:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to Build an If Statement based on if a field contains a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297917#M89862</link>
      <description>&lt;P&gt;thank you this works!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 19:21:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Build-an-If-Statement-based-on-if-a-field-contains-a/m-p/297917#M89862</guid>
      <dc:creator>katzr</dc:creator>
      <dc:date>2018-01-08T19:21:36Z</dc:date>
    </item>
  </channel>
</rss>

