<?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 multiple spaces in a single field containing unique words in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341272#M160775</link>
    <description>&lt;P&gt;Sometimes extraneous spaces affect the results.  Try removing the space after &lt;CODE&gt;replace&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 19:22:19 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2017-06-16T19:22:19Z</dc:date>
    <item>
      <title>How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341262#M160765</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;

&lt;P&gt;I'm having a bit of problem removing spaces in between several words in a column. For example, the User_Name column value is John Doe. How can I combine both words together to become JohnDoe? The User_Name field contains various unique names with first, middle and last names (e.g. Michael Derek Adkins) and some has 2 or more spaces in between the names.&lt;/P&gt;

&lt;P&gt;User_Name&lt;BR /&gt;
John Doe&lt;BR /&gt;
Thomas Hardy Jr&lt;BR /&gt;
Liu XinWang Ken Lim&lt;/P&gt;

&lt;P&gt;Combine_Name (desired results)&lt;BR /&gt;
JohnDoe&lt;BR /&gt;
ThomasHardyJr&lt;BR /&gt;
LiuXinWangKenLim&lt;/P&gt;

&lt;P&gt;I've tried trim function or mvjoin but it was not successful.&lt;/P&gt;

&lt;P&gt;Thank you in advance for your kind help.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341262#M160765</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2020-09-29T14:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341263#M160766</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval Combine_Name=replace (User_Name, " ", "") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2017 12:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341263#M160766</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-09T12:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341264#M160767</link>
      <description>&lt;P&gt;I would use rex in SED mode in order to remove any space characters:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Combined_Name = User_Name
| rex field=Combined_Name mode=sed "s/\s+//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | fields - _time
| eval User_Name = split("John Doe, Thomas Hardy Jr, Liu XinWang Ken Lim", ",")
| mvexpand User_Name
| eval Combined_Name = User_Name
| rex field=Combined_Name mode=sed "s/\s+//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output (see picture below):&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/f5NZ494.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 12:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341264#M160767</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2017-06-09T12:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341265#M160768</link>
      <description>&lt;P&gt;You need to use global flag in your sed string &lt;CODE&gt;"s/\s+//g"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 14:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341265#M160768</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-09T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341266#M160769</link>
      <description>&lt;P&gt;Thank you. I've tried it but the column is returning blank results&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2017 15:13:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341266#M160769</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2017-06-11T15:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341267#M160770</link>
      <description>&lt;P&gt;Thanks Rich.&lt;BR /&gt;
It didnt worked as the field returned blank results. Is there somethig that i missed? &lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2017 15:19:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341267#M160770</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2017-06-11T15:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341268#M160771</link>
      <description>&lt;P&gt;Thanks a lot this seems workable. Since the User_Name field will always return a lot of names, how can i not hardcode the names in split function so that it will remove the spaces for whatever names that are in the results?&lt;/P&gt;

&lt;P&gt;Can i use the one below?&lt;/P&gt;

&lt;P&gt;| eval split(User_Name, ",")&lt;BR /&gt;
| mvexpand User_Name&lt;BR /&gt;
| eval Combined_Name = User Name&lt;BR /&gt;
| rex field = Combined_Name mod=sed "s/\s+//"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341268#M160771</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2020-09-29T14:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341269#M160772</link>
      <description>&lt;P&gt;Thanks a lot this seems workable. Looking at your result, it's only removing the space for the first name. There are still spaces for the subsequent names. Also, i've tried it and it only removes the first space. For example, John C Doe only returned as JohnC Doe. &lt;/P&gt;

&lt;P&gt;Since the User_Name field will always return a lot of names, how can i not hardcode the names in split function so that it will remove the spaces for whatever names that are in the results?&lt;/P&gt;

&lt;P&gt;Can i use the one below? It didnt worked though.&lt;/P&gt;

&lt;P&gt;| eval split(User_Name, ",")&lt;BR /&gt;
| mvexpand User_Name&lt;BR /&gt;
| eval Combined_Name = User Name&lt;BR /&gt;
| rex field = Combined_Name mod=sed "s/\s+//"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341269#M160772</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2020-09-29T14:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341270#M160773</link>
      <description>&lt;P&gt;++1 for somesoni2.&lt;BR /&gt;
Didn't notice that. Will fix my answer&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 08:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341270#M160773</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2017-06-12T08:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341271#M160774</link>
      <description>&lt;P&gt;You are not using eval split in the right form. Try this way instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Combined_Name = split(User_Name, ",")
| mvexpand Combined_Name
| rex field = Combined_Name mod=sed "s/\s+//g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jun 2017 08:18:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341271#M160774</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2017-06-12T08:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove multiple spaces in a single field containing unique words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341272#M160775</link>
      <description>&lt;P&gt;Sometimes extraneous spaces affect the results.  Try removing the space after &lt;CODE&gt;replace&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 19:22:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-multiple-spaces-in-a-single-field-containing/m-p/341272#M160775</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-16T19:22:19Z</dc:date>
    </item>
  </channel>
</rss>

