<?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 use substr to extract the first character of a string and keep all characters up until the first space character? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-substr-to-extract-the-first-character-of-a-string-and/m-p/257528#M77125</link>
    <description>&lt;P&gt;Hi bhicks32&lt;/P&gt;

&lt;P&gt;Use the "rex" command. It's much more flexible than substr.&lt;/P&gt;

&lt;P&gt;For this string it would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; YOURSEARCH | rex field=YOURFIELD "(?&amp;lt;NEWFIELD&amp;gt;[^\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you are not entirely familiar with regex I can recommend this site as a reference:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://regexr.com/"&gt;http://regexr.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If this works, please mark as answered.&lt;/P&gt;

&lt;P&gt;j&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jan 2016 23:56:59 GMT</pubDate>
    <dc:creator>jbjerke_splunk</dc:creator>
    <dc:date>2016-01-28T23:56:59Z</dc:date>
    <item>
      <title>How to use substr to extract the first character of a string and keep all characters up until the first space character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-substr-to-extract-the-first-character-of-a-string-and/m-p/257527#M77124</link>
      <description>&lt;P&gt;I have a string &lt;CODE&gt;nadcwppcxicc01x CPU Usage has exceeded the threshold for 30 minutes &amp;amp;I&lt;/CODE&gt; where I would like to create a new column and extract from the string where it would show &lt;CODE&gt;nadcwppcxicc01x&lt;/CODE&gt; only. I know this would be possible using &lt;CODE&gt;substr(tablename,1,15)&lt;/CODE&gt;, however, I have other strings that differ in length.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 22:19:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-substr-to-extract-the-first-character-of-a-string-and/m-p/257527#M77124</guid>
      <dc:creator>bhicks32</dc:creator>
      <dc:date>2016-01-28T22:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use substr to extract the first character of a string and keep all characters up until the first space character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-substr-to-extract-the-first-character-of-a-string-and/m-p/257528#M77125</link>
      <description>&lt;P&gt;Hi bhicks32&lt;/P&gt;

&lt;P&gt;Use the "rex" command. It's much more flexible than substr.&lt;/P&gt;

&lt;P&gt;For this string it would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; YOURSEARCH | rex field=YOURFIELD "(?&amp;lt;NEWFIELD&amp;gt;[^\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you are not entirely familiar with regex I can recommend this site as a reference:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://regexr.com/"&gt;http://regexr.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If this works, please mark as answered.&lt;/P&gt;

&lt;P&gt;j&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 23:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-substr-to-extract-the-first-character-of-a-string-and/m-p/257528#M77125</guid>
      <dc:creator>jbjerke_splunk</dc:creator>
      <dc:date>2016-01-28T23:56:59Z</dc:date>
    </item>
  </channel>
</rss>

