<?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: How to remove spaces from the beginning and end of a field value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281358#M84874</link>
    <description>&lt;P&gt;I had this same problem and&lt;CODE&gt;|eval NewField=trim(OldField)&lt;/CODE&gt; worked great!  &lt;STRONG&gt;Thank you so much!&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2016 20:06:32 GMT</pubDate>
    <dc:creator>Phil219</dc:creator>
    <dc:date>2016-02-11T20:06:32Z</dc:date>
    <item>
      <title>How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281354#M84870</link>
      <description>&lt;P&gt;I want to remove spaces from starting and ending of field&lt;/P&gt;

&lt;P&gt;I was trying to achieve this using&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex mode=sed field=A "s/ //g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it removes all spaces from the field (within the field also).&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 17:06:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281354#M84870</guid>
      <dc:creator>mkhan_splunk</dc:creator>
      <dc:date>2015-12-16T17:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281355#M84871</link>
      <description>&lt;P&gt;Have you tried to &lt;CODE&gt;trim&lt;/CODE&gt; function? &lt;CODE&gt;.. | eval nospace=trim(A)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 17:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281355#M84871</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-16T17:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281356#M84872</link>
      <description>&lt;P&gt;I am not able to use trim with &lt;BR /&gt;
| eval search="&lt;EM&gt;$value$&lt;/EM&gt;"&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 17:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281356#M84872</guid>
      <dc:creator>mkhan_splunk</dc:creator>
      <dc:date>2015-12-17T17:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281357#M84873</link>
      <description>&lt;P&gt;you could do &lt;CODE&gt;| eval search=$value$" | eval search=trim(search)&lt;/CODE&gt; What is the real problem you are trying to solve?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 17:31:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281357#M84873</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-17T17:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281358#M84874</link>
      <description>&lt;P&gt;I had this same problem and&lt;CODE&gt;|eval NewField=trim(OldField)&lt;/CODE&gt; worked great!  &lt;STRONG&gt;Thank you so much!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 20:06:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281358#M84874</guid>
      <dc:creator>Phil219</dc:creator>
      <dc:date>2016-02-11T20:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281359#M84875</link>
      <description>&lt;P&gt;trim worked.&lt;BR /&gt;
but why rex is adding spaces to the value retrieved ?&lt;BR /&gt;
what should i change in rex to avoid the space, as if i have 5-10 fields extracted, each will have the trailing and leading space to their values.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 17:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281359#M84875</guid>
      <dc:creator>maniishpawar</dc:creator>
      <dc:date>2017-11-17T17:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281360#M84876</link>
      <description>&lt;P&gt;The regex from your sed command going to remove single spaces globally from your string anywhere it finds a space. Try stripping repeating whitespace from beginning of line and end of line.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval A=" leading and trailing spaces      " , a_len=len(A)
| rex field=A mode=sed "s/^\s+//g"
| rex field=A mode=sed "s/\s+$//g"
| eval new_len=len(A)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Nov 2017 22:13:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281360#M84876</guid>
      <dc:creator>shaskell_splunk</dc:creator>
      <dc:date>2017-11-17T22:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281361#M84877</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rex field=field1 "(?&amp;lt;newfield&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Mar 2018 15:58:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/281361#M84877</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-03-27T15:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove spaces from the beginning and end of a field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/508441#M142068</link>
      <description>&lt;P&gt;You can also try this to remove space in both ends&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| rex field=myField mode=sed "s/(^\s+)|(\s+$)//g" &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 06:05:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-spaces-from-the-beginning-and-end-of-a-field-value/m-p/508441#M142068</guid>
      <dc:creator>senthilsisc</dc:creator>
      <dc:date>2020-07-10T06:05:17Z</dc:date>
    </item>
  </channel>
</rss>

