<?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 space and tab char between from &amp;quot;&amp;gt;&amp;quot;  &amp;quot;&amp;lt;\&amp;quot; in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106886#M22477</link>
    <description>&lt;P&gt;So does the string you're matching against actually contain &lt;CODE&gt;\"&lt;/CODE&gt; with backslash and everything?&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jul 2012 16:15:55 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2012-07-24T16:15:55Z</dc:date>
    <item>
      <title>remove space and tab char between from "&gt;"  "&lt;\"</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106885#M22476</link>
      <description>&lt;P&gt;I want to remove all the spaces in between &lt;CODE&gt;"&amp;gt;"    "&amp;lt;\"&lt;/CODE&gt; and want to use this in SEDCMD &lt;/P&gt;

&lt;P&gt;Here is my regex but this is not working &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-RemoveSpaceChar = s/"&amp;gt;\s+&amp;lt;\\"/""/g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jul 2012 16:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106885#M22476</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2012-07-24T16:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: remove space and tab char between from "&gt;"  "&lt;\"</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106886#M22477</link>
      <description>&lt;P&gt;So does the string you're matching against actually contain &lt;CODE&gt;\"&lt;/CODE&gt; with backslash and everything?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 16:15:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106886#M22477</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-07-24T16:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: remove space and tab char between from "&gt;"  "&lt;\"</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106887#M22478</link>
      <description>&lt;P&gt;If you are looking to remove whitespaces, the best approach is to focus on situations where you see more than one whitespace and remove. You can accomplish that with the following;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-remove-white-space = s/\s{2,}//g  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To test this during an in-line search, use this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=xml_blah blah blah | rex mode=sed "s/\s{2,}//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will translate this:&lt;/P&gt;

&lt;P&gt;&amp;lt;xml_property_document&amp;gt;&lt;BR /&gt;&lt;BR /&gt;
    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xml_property_outer xml_variable=variable value&amp;gt;&lt;BR /&gt;&lt;BR /&gt;
        &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xml_property_inner&amp;gt;inner property value&amp;lt;/xml_property_inner&amp;gt;&lt;BR /&gt;&lt;BR /&gt;
    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xml_property_outer&amp;gt;&lt;BR /&gt;&lt;BR /&gt;
&amp;lt;/xml_property_document&amp;gt;  &lt;/P&gt;

&lt;P&gt;Into this:&lt;/P&gt;

&lt;P&gt;&amp;lt;xml_property_document&amp;gt;&amp;lt;xml_property_outer xml_variable=variable value&amp;gt;&amp;lt;xml_property_inner&amp;gt;inner property value&amp;lt;/xml_property_inner&amp;gt;&amp;lt;/xml_property_outer&amp;gt;&amp;lt;/xml_property_document&amp;gt;&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;
I do not think the SEDCMD command will allow you to capture the "&amp;lt;" and "&amp;gt;" characters and not replace them.  &lt;/P&gt;

&lt;P&gt;BTW: The reason we opt for anything beyond a single white space is because XML may contain spaces in the presented values, as well is in tree-branch variables. After all, you do not want to remove all spaces; just the extra items that make it difficult for a human to read.&lt;/P&gt;

&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:08:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/remove-space-and-tab-char-between-from-quot-gt-quot-quot-lt-quot/m-p/106887#M22478</guid>
      <dc:creator>Gilberto_Castil</dc:creator>
      <dc:date>2020-09-28T12:08:16Z</dc:date>
    </item>
  </channel>
</rss>

