<?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: Why does the trim function not work on numeric values without spaces? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280902#M176069</link>
    <description>&lt;P&gt;How about when you convert from number to string?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   &amp;lt;your base search&amp;gt; | eval a=tostring(a) | eval b=trim(a)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Dec 2016 19:52:53 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2016-12-15T19:52:53Z</dc:date>
    <item>
      <title>Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280895#M176062</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
We have a column where value can be string, alphanumeric, numeric, and with/without spaces before and after it.&lt;BR /&gt;
Trim function works perfect for string, alphanumeric values with or without spaces. It also works when value is numeric with space.&lt;BR /&gt;
However, when value is numeric and without any space, it displays in exponential format.&lt;/P&gt;

&lt;P&gt;Trim works when data is like: &lt;CODE&gt;"G12345", "G98765    ", "UPHAV", OUGNJGF    ", "67537658     "&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Trim displays in exponential when data is like: &lt;CODE&gt;"98753567" (Number without space)&lt;/CODE&gt; displays like &lt;CODE&gt;(1.49554e+09)&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;1) Is there any alternative to trim, which is generic and satisfies all above condition?&lt;BR /&gt;
2) Can we have any if condition to find out a value which is numeric but without any space before and after it?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 12:14:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280895#M176062</guid>
      <dc:creator>anantdeshpande</dc:creator>
      <dc:date>2016-12-15T12:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280896#M176063</link>
      <description>&lt;P&gt;Which version of Splunk are you using?  What is your SPL?  I can't reproduce this in 6.5.1.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:45:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280896#M176063</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-12-15T13:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280897#M176064</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults |eval a=98753567 | eval b=trim(a)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What do you mean?&lt;/P&gt;

&lt;P&gt;This example shows no problem.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:39:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280897#M176064</guid>
      <dc:creator>tkomatsubara_sp</dc:creator>
      <dc:date>2016-12-15T14:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280898#M176065</link>
      <description>&lt;P&gt;I am using Splunk 6.2&lt;BR /&gt;
| makeresults |eval a=98753567 | eval b=trim(a) - using same in 6.2 is not working&lt;/P&gt;

&lt;P&gt;Can anyone try  and let us know if thats the limitation in 6.2&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 16:59:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280898#M176065</guid>
      <dc:creator>anantdeshpande</dc:creator>
      <dc:date>2016-12-15T16:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280899#M176066</link>
      <description>&lt;P&gt;The command makeresults is available only on 6.3.x and above. I've tried similar search (below) on 6.2.6 and 6.2.12 it works just fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1  |eval a=98753567 | table a | eval b=trim(a) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 17:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280899#M176066</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-15T17:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280900#M176067</link>
      <description>&lt;P&gt;Sorry, I am not using makeresults. My query looks like below:&lt;BR /&gt;
Index=abc sourcetype=xyz | eval CUST_ID=123456 | eval NEW_CUST_ID=trim(CUST_ID)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:10:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280900#M176067</guid>
      <dc:creator>anantdeshpande</dc:creator>
      <dc:date>2020-09-29T12:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280901#M176068</link>
      <description>&lt;P&gt;Would you be able to post a screenshot of the search result? Something similar works just fine for me on 6.2.6.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd | eval CUST_ID=123456 | eval NEW_CUST_ID=trim(CUST_ID)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 19:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280901#M176068</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-15T19:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280902#M176069</link>
      <description>&lt;P&gt;How about when you convert from number to string?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   &amp;lt;your base search&amp;gt; | eval a=tostring(a) | eval b=trim(a)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 19:52:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280902#M176069</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-15T19:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280903#M176070</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Looks like issue is when digits are more than 6 digits. works when CUST_ID is 123456 but gives exponential when CUST_ID is 1234567 . Please try on Splunk 6.2 .&lt;/P&gt;

&lt;P&gt;index=_internal sourcetype=splunkd | eval CUST_ID=1234567 | eval NEW_CUST_ID=trim(CUST_ID)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280903#M176070</guid>
      <dc:creator>anantdeshpande</dc:creator>
      <dc:date>2020-09-29T12:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280904#M176071</link>
      <description>&lt;P&gt;also, our Splunk is 6.2.0&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 05:19:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280904#M176071</guid>
      <dc:creator>anantdeshpande</dc:creator>
      <dc:date>2016-12-16T05:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280905#M176072</link>
      <description>&lt;P&gt;your spl does give exponential error in 6.2.2...&lt;/P&gt;

&lt;P&gt;You can try appending space in your evail and then continue to use trim...this will ensure numric value with no space gets a space and your trim continues to work..below SPL works just fine&lt;/P&gt;

&lt;P&gt;index=_internal sourcetype=splunkd | eval CUST_ID=1234567 |eval CUST_ID=CUST_ID." "| eval NEW_CUST_ID=trim(CUST_ID) | table NEW_CUST_ID&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:08:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280905#M176072</guid>
      <dc:creator>nekbote</dc:creator>
      <dc:date>2020-09-29T12:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280906#M176073</link>
      <description>&lt;P&gt;with one less eval compared to previous one..&lt;BR /&gt;
index=_internal sourcetype=splunkd | eval CUST_ID=12345678910 | eval NEW_CUST_ID=trim(CUST_ID." ") | table NEW_CUST_ID&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:08:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280906#M176073</guid>
      <dc:creator>nekbote</dc:creator>
      <dc:date>2020-09-29T12:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the trim function not work on numeric values without spaces?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280907#M176074</link>
      <description>&lt;P&gt;Hi all, Thanks for the comments. TRIM function on number without space in Splunk 6.2.0 is not working for us.&lt;BR /&gt;
However &lt;CODE&gt;cust_id=replace(cust_id, " ","")&lt;/CODE&gt; [there is space between first double cote] is working perfectly for all data with or without space.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 06:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-the-trim-function-not-work-on-numeric-values-without/m-p/280907#M176074</guid>
      <dc:creator>anantdeshpande</dc:creator>
      <dc:date>2016-12-21T06:56:57Z</dc:date>
    </item>
  </channel>
</rss>

