<?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 Need string minus last 2 characters in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-string-minus-last-2-characters/m-p/91308#M23482</link>
    <description>&lt;P&gt;I am trying to set a field to the value of a string without the last 2 digits.  For example:&lt;/P&gt;

&lt;P&gt;Hotel=297654 from 29765423 &lt;BR /&gt;
Hotel=36345 from 3624502&lt;/P&gt;

&lt;P&gt;I tried rtrim but docs say you must know the exact string you're removing, mine are different every time.   I also tried substr but the length is not constant from 1st character and using -2 like substr(Field, -2) returns the last 2 characters...the part I want to throw away.&lt;/P&gt;

&lt;P&gt;Was trying something like rtrim(Field,substr(Field,-2) but can't get that to work.&lt;/P&gt;

&lt;P&gt;Suggestions?  - THANKS&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2011 17:07:19 GMT</pubDate>
    <dc:creator>rachelneal</dc:creator>
    <dc:date>2011-10-13T17:07:19Z</dc:date>
    <item>
      <title>Need string minus last 2 characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-string-minus-last-2-characters/m-p/91308#M23482</link>
      <description>&lt;P&gt;I am trying to set a field to the value of a string without the last 2 digits.  For example:&lt;/P&gt;

&lt;P&gt;Hotel=297654 from 29765423 &lt;BR /&gt;
Hotel=36345 from 3624502&lt;/P&gt;

&lt;P&gt;I tried rtrim but docs say you must know the exact string you're removing, mine are different every time.   I also tried substr but the length is not constant from 1st character and using -2 like substr(Field, -2) returns the last 2 characters...the part I want to throw away.&lt;/P&gt;

&lt;P&gt;Was trying something like rtrim(Field,substr(Field,-2) but can't get that to work.&lt;/P&gt;

&lt;P&gt;Suggestions?  - THANKS&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2011 17:07:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-string-minus-last-2-characters/m-p/91308#M23482</guid>
      <dc:creator>rachelneal</dc:creator>
      <dc:date>2011-10-13T17:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need string minus last 2 characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-string-minus-last-2-characters/m-p/91309#M23483</link>
      <description>&lt;P&gt;This may do it:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;your_search_here&amp;gt; | eval myfield = substr(myfield, 1, len(myfield)-2)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;d.&lt;/P&gt;

&lt;P&gt;-&lt;BR /&gt;
&lt;CODE&gt;please upvote if you find this answer useful&lt;/CODE&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2011 17:44:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-string-minus-last-2-characters/m-p/91309#M23483</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-10-13T17:44:58Z</dc:date>
    </item>
  </channel>
</rss>

