<?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: What is the equivalent of ORACLE SQL 'instr ' in SPLUNK? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206749#M22018</link>
    <description>&lt;P&gt;Also try the field extractor if you're not sure how to write the regex - &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2015 10:30:51 GMT</pubDate>
    <dc:creator>jplumsdaine22</dc:creator>
    <dc:date>2015-12-22T10:30:51Z</dc:date>
    <item>
      <title>What is the equivalent of ORACLE SQL 'instr ' in SPLUNK?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206747#M22016</link>
      <description>&lt;P&gt;I am trying to substring a text depending on the varying positions of the "_"&lt;/P&gt;

&lt;P&gt;The query in SQL =&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CASE
    WHEN SUBSTR(DSLAM_NAME,1,instr(DSLAM_NAME,'_')-1) IS NULL THEN SUBSTR(DSLAM_NAME,1,instr(DSLAM_NAME,'-')-1)
    ELSE
    SUBSTR(DSLAM_NAME,1,instr(DSLAM_NAME,'_')-1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2015 02:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206747#M22016</guid>
      <dc:creator>asagban</dc:creator>
      <dc:date>2015-12-22T02:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: What is the equivalent of ORACLE SQL 'instr ' in SPLUNK?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206748#M22017</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Regex"&gt;Regular Expressions&lt;/A&gt; are what you are looking for. For instance by using &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/rex"&gt;rex&lt;/A&gt; :&lt;BR /&gt;
(I'm not sure what exactly you are trying. Looks like you want to skip the first char and everything until an "-" if there is one or the rest of the string if there is no "-"). Warning: no look all in (Regex is untested); however, something like this should do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ".(?P&amp;lt;extracted_field_name&amp;gt;.*?)[-]{0,1}.*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2015 07:16:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206748#M22017</guid>
      <dc:creator>Sebastian2</dc:creator>
      <dc:date>2015-12-22T07:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: What is the equivalent of ORACLE SQL 'instr ' in SPLUNK?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206749#M22018</link>
      <description>&lt;P&gt;Also try the field extractor if you're not sure how to write the regex - &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 10:30:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206749#M22018</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2015-12-22T10:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: What is the equivalent of ORACLE SQL 'instr ' in SPLUNK?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206750#M22019</link>
      <description>&lt;P&gt;I agree I would use regular expressions to mimic the Oracle instr function, but I think it is also possible with a fairly ugly eval statement&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... |eval fieldname=(if(mvcount(split(DSLAM_NAME,"_")&amp;gt;1,mvindex(split(DSLAM_NAME,"_"),0),mvindex(split(DSLAM_NAME,"-"),0))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 12:12:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/What-is-the-equivalent-of-ORACLE-SQL-instr-in-SPLUNK/m-p/206750#M22019</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2015-12-23T12:12:39Z</dc:date>
    </item>
  </channel>
</rss>

