<?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: Remove spaces in field values and run stats/timechart with new names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217275#M63833</link>
    <description>&lt;P&gt;OK, so the problem is not that your field &lt;CODE&gt;name&lt;/CODE&gt; has spaces but rather that your field &lt;CODE&gt;value&lt;/CODE&gt; does.  So you do not need &lt;CODE&gt;rename&lt;/CODE&gt;, you need something else.  Try using this (&lt;EM&gt;early&lt;/EM&gt; in your command chain):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field="Current City" mode=sed "s/ /_/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jun 2016 15:29:04 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2016-06-23T15:29:04Z</dc:date>
    <item>
      <title>Remove spaces in field values and run stats/timechart with new names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217274#M63832</link>
      <description>&lt;P&gt;I notice Splunk uses the first Word when using stats, so I need to rename the fields to single words or connected words.&lt;/P&gt;

&lt;P&gt;I am trying to remove spaces in field names and use the new name to be used in drop-downs and timecharts. Till now, I've been unable to perform this. Following is a drop-down menu where&lt;BR /&gt;
I only want unique City Names. I would also want to use the new names in stats.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       source=location sourcetype=location_data
                  | search * "Current City" 
          | dedup "Current City"  
                  | sort "Current City"                   
          | rename "Current City" as City 
                  | rename "Current State" as State 
                  | rename "Current Location" as Location
                  | fields City
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jun 2016 21:23:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217274#M63832</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-06-22T21:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Remove spaces in field values and run stats/timechart with new names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217275#M63833</link>
      <description>&lt;P&gt;OK, so the problem is not that your field &lt;CODE&gt;name&lt;/CODE&gt; has spaces but rather that your field &lt;CODE&gt;value&lt;/CODE&gt; does.  So you do not need &lt;CODE&gt;rename&lt;/CODE&gt;, you need something else.  Try using this (&lt;EM&gt;early&lt;/EM&gt; in your command chain):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field="Current City" mode=sed "s/ /_/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2016 15:29:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217275#M63833</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-23T15:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Remove spaces in field values and run stats/timechart with new names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217276#M63834</link>
      <description>&lt;P&gt;Excellent this works, is it possible to do the same thing without removing spaces ? Keeping column values as it is ?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217276#M63834</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-06-23T18:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Remove spaces in field values and run stats/timechart with new names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217277#M63835</link>
      <description>&lt;P&gt;Yes, you can protect your values by surrounding the field name references with double-quotes or dollar-signs.  It all depends on your actual XML and search.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-spaces-in-field-values-and-run-stats-timechart-with-new/m-p/217277#M63835</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-23T18:48:35Z</dc:date>
    </item>
  </channel>
</rss>

