<?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: Extract a field from a search and remove trailing character in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541142#M153187</link>
    <description>&lt;P&gt;You can just search for both index at same time and then use SED to remove training _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_1 OR index=index_2
| rex mode=sed field=timerName "s/_$//"&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 24 Feb 2021 09:09:35 GMT</pubDate>
    <dc:creator>jotne</dc:creator>
    <dc:date>2021-02-24T09:09:35Z</dc:date>
    <item>
      <title>Extract a field from a search and remove trailing character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541095#M153172</link>
      <description>&lt;P&gt;I have 2 splunk indexes from which I need to gather data from, so I have a simple splunk search (that queries for different timers) which retuns the different timer names used in our service but one of the indexes returns the same timer name with a trailing "_".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg: timerName=ABC.transaction_&lt;/P&gt;&lt;P&gt;How can I remove the trailing "_" from the timerName from the results obtained so that when I perform the stats command, it doesn't show the trailing "_"? Also, how can I merge the results from the 2 indexes into one?&lt;/P&gt;&lt;P&gt;Any help is appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 22:41:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541095#M153172</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2021-02-23T22:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a field from a search and remove trailing character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541096#M153173</link>
      <description>&lt;P&gt;I found &lt;A href="https://community.splunk.com/t5/Splunk-Search/how-to-remove-last-character-of-a-field-value-from-the-search/m-p/201432" target="_self"&gt;this&lt;/A&gt; to remove the trailing "_" but I still haven't figured out how to merge the two results from the different indexes into one&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 22:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541096#M153173</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2021-02-23T22:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a field from a search and remove trailing character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541109#M153178</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/195013"&gt;@thenormalone&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can use below sample; replace function will replace _ only if it is at the end.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;( index=index1 OR index=index2 ) timerName=*
| eval timerName = replace(timer_Name,"_$","")
| stats count by timerName&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Feb 2021 04:46:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541109#M153178</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-02-24T04:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a field from a search and remove trailing character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541142#M153187</link>
      <description>&lt;P&gt;You can just search for both index at same time and then use SED to remove training _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_1 OR index=index_2
| rex mode=sed field=timerName "s/_$//"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Feb 2021 09:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/541142#M153187</guid>
      <dc:creator>jotne</dc:creator>
      <dc:date>2021-02-24T09:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a field from a search and remove trailing character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/542015#M153517</link>
      <description>&lt;P&gt;Those work, thank you! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 17:32:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-field-from-a-search-and-remove-trailing-character/m-p/542015#M153517</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2021-03-02T17:32:22Z</dc:date>
    </item>
  </channel>
</rss>

