<?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 get rid of extra space from the output of a splunk query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569790#M198591</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The extra spaces of the file name are blank spaces? If so, you could use the&amp;nbsp;&lt;STRONG&gt;trim&lt;/STRONG&gt; command to remove these spaces like the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "sent to:  https://someurl/(?&amp;lt;file&amp;gt;.*)" 
| eval file = trim(file)
| table file&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 20:41:33 GMT</pubDate>
    <dc:creator>danielcj</dc:creator>
    <dc:date>2021-10-05T20:41:33Z</dc:date>
    <item>
      <title>How to get rid of extra space from the output of a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569630#M198537</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;I have a splunk command which returns a filename as the output. But i found that there is an extra space before and after the filename.&lt;/P&gt;&lt;P&gt;query i am running here is,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;filetest | rex "sent to:&amp;nbsp; &lt;A href="https://someurl/" target="_blank" rel="noopener"&gt;https://someurl/&lt;/A&gt;(?&amp;lt;file&amp;gt;.*)" | table file&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output displayed as:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;...............................&lt;/P&gt;&lt;P&gt;..............................&lt;/P&gt;&lt;P&gt;.............................&lt;/P&gt;&lt;P&gt;..............................&lt;/P&gt;&lt;P&gt;file.txt&lt;/P&gt;&lt;P&gt;.............................&lt;/P&gt;&lt;P&gt;...........................&lt;/P&gt;&lt;P&gt;............................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can i get rid of the extra space before and after the file name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:23:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569630#M198537</guid>
      <dc:creator>maramk</dc:creator>
      <dc:date>2021-10-05T15:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of extra space from the output of a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569788#M198590</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Can you try&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex field=file mode=sed "s/(^\s+)|(\s+$)//g"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 20:25:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569788#M198590</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2021-10-05T20:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of extra space from the output of a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569790#M198591</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The extra spaces of the file name are blank spaces? If so, you could use the&amp;nbsp;&lt;STRONG&gt;trim&lt;/STRONG&gt; command to remove these spaces like the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "sent to:  https://someurl/(?&amp;lt;file&amp;gt;.*)" 
| eval file = trim(file)
| table file&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 20:41:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569790#M198591</guid>
      <dc:creator>danielcj</dc:creator>
      <dc:date>2021-10-05T20:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of extra space from the output of a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569795#M198593</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213178"&gt;@danielcj&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Thanks for the response. The above command you suggested doesn't remove extra lines. Its returning the same result before and after.&lt;/P&gt;&lt;P&gt;&amp;nbsp; I am running the query to match a file name from the splunk logs and extracting it to display. But there are empty lines before and after the file name as below.&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;............................&lt;/P&gt;&lt;P&gt;...........................&lt;/P&gt;&lt;P&gt;..........................&lt;/P&gt;&lt;P&gt;file.txt&lt;/P&gt;&lt;P&gt;.........................&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;..................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you suggest me anything better. Appreciate your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 21:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569795#M198593</guid>
      <dc:creator>maramk</dc:creator>
      <dc:date>2021-10-05T21:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of extra space from the output of a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569796#M198594</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/169081"&gt;@Azeemering&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I tried it as you suggested well. Check the command i run below for my query. Please suggest me if i can make it better to get the file name without empty lines before and after.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename | rex "uploaded to: s3:someurl/(?&amp;lt;json&amp;gt;.*)" | rex field=json mode=sed "s/(^\s+)|(\s+$)//g" | table json&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output still showing as,&lt;/P&gt;&lt;P&gt;................................&lt;/P&gt;&lt;P&gt;..............................&lt;/P&gt;&lt;P&gt;.............................&lt;/P&gt;&lt;P&gt;file.txt&lt;/P&gt;&lt;P&gt;..............................&lt;/P&gt;&lt;P&gt;..............................&lt;/P&gt;&lt;P&gt;............................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to get rid of those extra lines and display just the file name. I appreciate your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 21:38:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569796#M198594</guid>
      <dc:creator>maramk</dc:creator>
      <dc:date>2021-10-05T21:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of extra space from the output of a splunk query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569803#M198598</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213178"&gt;@danielcj&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/169081"&gt;@Azeemering&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;adding "where isnotnull(json)" at the end of the query fixed the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 22:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-rid-of-extra-space-from-the-output-of-a-splunk-query/m-p/569803#M198598</guid>
      <dc:creator>maramk</dc:creator>
      <dc:date>2021-10-05T22:52:14Z</dc:date>
    </item>
  </channel>
</rss>

