<?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: Extracting a string from the search result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208696#M60918</link>
    <description>&lt;P&gt;But it is not displaying the string 'Start' alone. It displays the whole result &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; I want it to display only 'Start'&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2016 05:17:45 GMT</pubDate>
    <dc:creator>zeewagon</dc:creator>
    <dc:date>2016-11-04T05:17:45Z</dc:date>
    <item>
      <title>Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208693#M60915</link>
      <description>&lt;P&gt;INFO : Start Outputing Report: Project ID:c_exactworld_17121, Format:EXCEL&lt;/P&gt;

&lt;P&gt;Above is my search result, and I wanna extract the word 'Start' alone. Like using 'awk' in bash. How do I do this in splunk?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208693#M60915</guid>
      <dc:creator>zeewagon</dc:creator>
      <dc:date>2020-09-29T11:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208694#M60916</link>
      <description>&lt;P&gt;What is your current search?  Do you want just "Start" or any word (like "Done") in that position?&lt;/P&gt;

&lt;P&gt;For the latter, try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ":\s+(?&amp;lt;start&amp;gt;\w+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 14:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208694#M60916</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-03T14:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208695#M60917</link>
      <description>&lt;P&gt;How about this (extracting as field Action)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "^\w+\s*:\s*(?&amp;lt;Action&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Updated per latest sample data&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "^(\S+\s){4}:\s(?&amp;lt;Action&amp;gt;\w+)" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample event&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2016-11-04 06:32:50,120 [http-bio-8443-exec-10862] INFO : Start Outputing Report: Project ID:c_exactworld_17121, Format:HTML, Locale: en_US
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 14:26:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208695#M60917</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-11-03T14:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208696#M60918</link>
      <description>&lt;P&gt;But it is not displaying the string 'Start' alone. It displays the whole result &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; I want it to display only 'Start'&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 05:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208696#M60918</guid>
      <dc:creator>zeewagon</dc:creator>
      <dc:date>2016-11-04T05:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208697#M60919</link>
      <description>&lt;P&gt;I think what @somesoni2 has as regex will capture what u need in "Action" field. Can u see &lt;A href="https://regex101.com/r/hnzZLh/2"&gt;here&lt;/A&gt; that his regex works the way you want it, unless ur data is something else than the one u posted in question.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 05:27:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208697#M60919</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-04T05:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208698#M60920</link>
      <description>&lt;P&gt;Okay.&lt;BR /&gt;
Here is the correct data.&lt;/P&gt;

&lt;P&gt;2016-11-04 06:32:50,120 [http-bio-8443-exec-10862] INFO : Start Outputing Report: Project ID:c_exactworld_17121, Format:HTML, Locale: en_US&lt;/P&gt;

&lt;P&gt;I want the only 'Start' string to be displayed in the results. How could we do that &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/194343"&gt;@gokadroid&lt;/a&gt; &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt; ?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208698#M60920</guid>
      <dc:creator>zeewagon</dc:creator>
      <dc:date>2020-09-29T11:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208699#M60921</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "INFO\s:\s(?&amp;lt;action&amp;gt;[^\s]+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Nov 2016 13:22:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208699#M60921</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-04T13:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208700#M60922</link>
      <description>&lt;P&gt;It is not working. I want only 'Start' to be displayed in the below line&lt;/P&gt;

&lt;P&gt;2016-11-04 06:32:50,120 [http-bio-8443-exec-10862] INFO : Start Outputing Report: Project ID:c_exactworld_17121, Format:HTML, Locale: en_US&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:40:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208700#M60922</guid>
      <dc:creator>zeewagon</dc:creator>
      <dc:date>2020-09-29T11:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208701#M60923</link>
      <description>&lt;P&gt;Since you wanted to work it like awk and looking at your new data:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Your word when separated by spaces comes at &lt;CODE&gt;awk '{print $6}'&lt;/CODE&gt;, so use the field &lt;CODE&gt;index6&lt;/CODE&gt; after applying the rex as below to get that:
&lt;CODE&gt;your base query&lt;/CODE&gt;
&lt;CODE&gt;| rex  "^(?&amp;lt;index1&amp;gt;[\S]+)\s(?&amp;lt;index2&amp;gt;[\S]+)\s(?&amp;lt;index3&amp;gt;[\S]+)\s(?&amp;lt;index4&amp;gt;[\S]+)\s(?&amp;lt;index5&amp;gt;[\S]+)\s(?&amp;lt;index6&amp;gt;[\S]+)\s(?&amp;lt;index7&amp;gt;[\S]+)\s(?&amp;lt;index8&amp;gt;[\S]+)\s(?&amp;lt;index9&amp;gt;[\S]+)\s(?&amp;lt;index10&amp;gt;[\S]+)\s(?&amp;lt;index11&amp;gt;[\S]+)\s(?&amp;lt;index12&amp;gt;[\S]+)\s(?&amp;lt;index13&amp;gt;[\S]+)"&lt;/CODE&gt;
&lt;CODE&gt;|stats count by index6&lt;/CODE&gt;
&lt;A href="https://regex101.com/r/L8i55p/1"&gt;See here&lt;/A&gt; &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Your word when separated by &lt;CODE&gt;":"&lt;/CODE&gt; comes as the first word of &lt;CODE&gt;awk -F":" '{print $4}'&lt;/CODE&gt; which needs another pipe of &lt;CODE&gt;awk '{print $1}'&lt;/CODE&gt;since "Start" is the first word of 4th index, hence find that piece as &lt;CODE&gt;index4&lt;/CODE&gt; below after applying rex:
&lt;CODE&gt;...| rex "^(?&amp;lt;index1&amp;gt;[^\:]+)\:(?&amp;lt;index2&amp;gt;[^\:]+)\:(?&amp;lt;index3&amp;gt;[^\:]+)\:\s(?&amp;lt;index4&amp;gt;[\S]+)\s(?&amp;lt;index5&amp;gt;[^\:]+)\:(?&amp;lt;index6&amp;gt;[^\:]+)\:(?&amp;lt;index7&amp;gt;[^\:]+)\:(?&amp;lt;index8&amp;gt;[^\:]+)\:\s*(?&amp;lt;index9&amp;gt;[^\s]+)"&lt;/CODE&gt;
&lt;CODE&gt;| stats count by index4&lt;/CODE&gt;
&lt;A href="https://regex101.com/r/oyzvl6/1"&gt;See here&lt;/A&gt;.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 04 Nov 2016 15:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208701#M60923</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-04T15:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a string from the search result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208702#M60924</link>
      <description>&lt;P&gt;On regex101.com, that rex command puts "Start" into the 'action' field.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 20:24:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-string-from-the-search-result/m-p/208702#M60924</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-04T20:24:41Z</dc:date>
    </item>
  </channel>
</rss>

