<?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: Truncate characters after a specific character using the Trim function in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579806#M202029</link>
    <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;rtrim&lt;/FONT&gt; function cannot do what you seek reliably.&amp;nbsp; You would have to give all characters as those to be trimmed and then you'd have nothing left.&amp;nbsp; &lt;FONT face="courier new,courier"&gt;rtrim&lt;/FONT&gt; doesn't have a concept trim-up-to-this-point.&lt;/P&gt;&lt;P&gt;If you don't want to use &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; then how about &lt;FONT face="courier new,courier"&gt;replace()&lt;/FONT&gt;?&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 18:53:34 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-01-03T18:53:34Z</dc:date>
    <item>
      <title>Truncate characters after a specific character using the Trim function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579800#M202027</link>
      <description>&lt;P&gt;Dear all, best wishes for 2022.&lt;/P&gt;&lt;P&gt;Is it possible to use rtrim to remove all characters out of a search result that come after a specific character? For example, using a FQDN, is it possible to use rtrim to remove every character after the host name (so after the dot)?&lt;/P&gt;&lt;P&gt;Original output: server1.domain.com&lt;/P&gt;&lt;P&gt;Desired output: server1&lt;/P&gt;&lt;P&gt;I am aware that regex can solve this, but I am looking for alternative options to solve this problem. This solution should ideally be working for any combination of servers and domain names.&lt;/P&gt;&lt;P&gt;Any help is welcome.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 16:37:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579800#M202027</guid>
      <dc:creator>ASplunkDummy</dc:creator>
      <dc:date>2022-01-03T16:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Truncate characters after a specific character using the Trim function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579806#M202029</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;rtrim&lt;/FONT&gt; function cannot do what you seek reliably.&amp;nbsp; You would have to give all characters as those to be trimmed and then you'd have nothing left.&amp;nbsp; &lt;FONT face="courier new,courier"&gt;rtrim&lt;/FONT&gt; doesn't have a concept trim-up-to-this-point.&lt;/P&gt;&lt;P&gt;If you don't want to use &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; then how about &lt;FONT face="courier new,courier"&gt;replace()&lt;/FONT&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 18:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579806#M202029</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-01-03T18:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Truncate characters after a specific character using the Trim function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579818#M202033</link>
      <description>&lt;P&gt;Thanks for your suggestion. I tried this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval ComputerName=replace(ComputerName, "^.*","([^\.]+)[\.].+")&lt;/LI-CODE&gt;&lt;P&gt;This should look for any value in FQDN format and replace it with only the server name (every character before the first dot). It does replace the value of ComputerName, but it replaces it with the literal text. It ignores the fact the second part is also a regular expression. I am lost here. What do I miss?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 23:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579818#M202033</guid>
      <dc:creator>ASplunkDummy</dc:creator>
      <dc:date>2022-01-03T23:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Truncate characters after a specific character using the Trim function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579820#M202034</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;replace&lt;/FONT&gt; function takes a regex only in the second argument.&amp;nbsp; The other two arguments are literal strings (or fields).&lt;/P&gt;&lt;P&gt;To replace a regex with another regex, use the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command with the &lt;FONT face="courier new,courier"&gt;sed&lt;/FONT&gt; option.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed field=ComputerName "s/^.*/([^\.]+)[\.].+/"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 01:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Truncate-characters-after-a-specific-character-using-the-Trim/m-p/579820#M202034</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-01-04T01:17:14Z</dc:date>
    </item>
  </channel>
</rss>

