<?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 a blank line from a file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/remove-a-blank-line-from-a-file/m-p/92534#M182367</link>
    <description>&lt;P&gt;This is a bit of an open-ended question, and if the following does not answer your question please provide some more details and examples.&lt;/P&gt;

&lt;P&gt;I suspect that you mean that if a field for a certain events contains a &lt;CODE&gt;NULL&lt;/CODE&gt; value (i.e. nothing), then you would like to exclude the whole event from the results. This is easily achievable by using the &lt;CODE&gt;where&lt;/CODE&gt; command and the &lt;CODE&gt;isnotnull()&lt;/CODE&gt; function. For example say I have the following search and results (where the fields have already been extracted):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=myST | table field1, field2, field3

field1 | field2 | field3
foo    |  1234  | qwerty
bar    |        | ytrewq
blah   |  5678  | qywter
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you wish to remove any row where field2 does not contain a value, you could extend the search to the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=myST | table field1, field2, field3 | where isnotnull(field2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which would give the following results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;foo    |  1234  | qwerty
blah   |  5678  | qywter
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps answer your question. If it does not, the following could be possible answers...&lt;/P&gt;

&lt;P&gt;If you mean that there are blank lines at the end of each event, or there are events with no values what so ever, you could be experiencing issues with line-breaking/event-breaking. If this is the case, you should look at the following (this will not work on historically indexed data, and may require a re-index of data):&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Data/Indexmulti-lineevents"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/Data/Indexmulti-lineevents&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you mean that your data sources are generating blank lines/fields and you wish to exclude these events, you should probably create a script that will read through and "modify" the output to meet your requirements using logical statements and funtions that strip out white space (e.g. such as python's &lt;CODE&gt;strip()&lt;/CODE&gt; function).&lt;/P&gt;

&lt;P&gt;For help on these points, please update your question with more details and examples&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;MHibbin&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2012 08:17:43 GMT</pubDate>
    <dc:creator>MHibbin</dc:creator>
    <dc:date>2012-10-17T08:17:43Z</dc:date>
    <item>
      <title>remove a blank line from a file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/remove-a-blank-line-from-a-file/m-p/92533#M182366</link>
      <description>&lt;P&gt;Hi , I would like to remove a blank line from a file based on certain fields&lt;/P&gt;

&lt;P&gt;If that field is blank, i will remove the whole record&lt;/P&gt;

&lt;P&gt;Kindly help !!&lt;/P&gt;

&lt;P&gt;Thanks &lt;BR /&gt;
Abhay&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2012 20:11:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/remove-a-blank-line-from-a-file/m-p/92533#M182366</guid>
      <dc:creator>abhayneilam</dc:creator>
      <dc:date>2012-10-16T20:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: remove a blank line from a file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/remove-a-blank-line-from-a-file/m-p/92534#M182367</link>
      <description>&lt;P&gt;This is a bit of an open-ended question, and if the following does not answer your question please provide some more details and examples.&lt;/P&gt;

&lt;P&gt;I suspect that you mean that if a field for a certain events contains a &lt;CODE&gt;NULL&lt;/CODE&gt; value (i.e. nothing), then you would like to exclude the whole event from the results. This is easily achievable by using the &lt;CODE&gt;where&lt;/CODE&gt; command and the &lt;CODE&gt;isnotnull()&lt;/CODE&gt; function. For example say I have the following search and results (where the fields have already been extracted):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=myST | table field1, field2, field3

field1 | field2 | field3
foo    |  1234  | qwerty
bar    |        | ytrewq
blah   |  5678  | qywter
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you wish to remove any row where field2 does not contain a value, you could extend the search to the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=myST | table field1, field2, field3 | where isnotnull(field2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which would give the following results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;foo    |  1234  | qwerty
blah   |  5678  | qywter
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps answer your question. If it does not, the following could be possible answers...&lt;/P&gt;

&lt;P&gt;If you mean that there are blank lines at the end of each event, or there are events with no values what so ever, you could be experiencing issues with line-breaking/event-breaking. If this is the case, you should look at the following (this will not work on historically indexed data, and may require a re-index of data):&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Data/Indexmulti-lineevents"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/Data/Indexmulti-lineevents&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you mean that your data sources are generating blank lines/fields and you wish to exclude these events, you should probably create a script that will read through and "modify" the output to meet your requirements using logical statements and funtions that strip out white space (e.g. such as python's &lt;CODE&gt;strip()&lt;/CODE&gt; function).&lt;/P&gt;

&lt;P&gt;For help on these points, please update your question with more details and examples&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;MHibbin&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2012 08:17:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/remove-a-blank-line-from-a-file/m-p/92534#M182367</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-10-17T08:17:43Z</dc:date>
    </item>
  </channel>
</rss>

