<?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: Function similar to grep in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375760#M110407</link>
    <description>&lt;P&gt;After reviewing the &lt;CODE&gt;grep&lt;/CODE&gt; man page, I see this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       -C NUM, -NUM, --context=NUM
              Print  NUM  lines of output context.  Places a line containing a
              group  separator  (described  under  --group-separator)  between
              contiguous  groups  of  matches.  With the -o or --only-matching
              option, this has no effect and a warning is given.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This has the effect of including the &lt;CODE&gt;NUM&lt;/CODE&gt; lines before and after each match.&lt;/P&gt;

&lt;P&gt;The answer is no, Splunk does not include this functionality as something standard.  It would potentially be able to do something similar, but it would likely involve a very inefficient search.&lt;/P&gt;

&lt;P&gt;There may be a better way to accomplish what you want.  Could you perhaps include some sample data for this use case?  This may allow others to come up with a proper method to find the events you need.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2018 04:10:05 GMT</pubDate>
    <dc:creator>micahkemp</dc:creator>
    <dc:date>2018-02-15T04:10:05Z</dc:date>
    <item>
      <title>Function similar to grep</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375758#M110405</link>
      <description>&lt;P&gt;I want Splunk to do the following actions.&lt;BR /&gt;
Is such a possibility possible?&lt;/P&gt;

&lt;HR /&gt;

&lt;H2&gt;grep -5 "error"test.txt&lt;/H2&gt;</description>
      <pubDate>Thu, 15 Feb 2018 00:34:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375758#M110405</guid>
      <dc:creator>oda</dc:creator>
      <dc:date>2018-02-15T00:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Function similar to grep</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375759#M110406</link>
      <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;splunk will return results that match your search string&lt;BR /&gt;
try and put in the search bar the following string: &lt;CODE&gt;"error" "test.txt"&lt;/CODE&gt;&lt;BR /&gt;
if its good, add  &lt;CODE&gt;| head 5&lt;/CODE&gt; meaning, bring me the first 5 results that have "error" and "test.txt" in&lt;/P&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 00:51:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375759#M110406</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-02-15T00:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Function similar to grep</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375760#M110407</link>
      <description>&lt;P&gt;After reviewing the &lt;CODE&gt;grep&lt;/CODE&gt; man page, I see this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       -C NUM, -NUM, --context=NUM
              Print  NUM  lines of output context.  Places a line containing a
              group  separator  (described  under  --group-separator)  between
              contiguous  groups  of  matches.  With the -o or --only-matching
              option, this has no effect and a warning is given.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This has the effect of including the &lt;CODE&gt;NUM&lt;/CODE&gt; lines before and after each match.&lt;/P&gt;

&lt;P&gt;The answer is no, Splunk does not include this functionality as something standard.  It would potentially be able to do something similar, but it would likely involve a very inefficient search.&lt;/P&gt;

&lt;P&gt;There may be a better way to accomplish what you want.  Could you perhaps include some sample data for this use case?  This may allow others to come up with a proper method to find the events you need.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 04:10:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Function-similar-to-grep/m-p/375760#M110407</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-15T04:10:05Z</dc:date>
    </item>
  </channel>
</rss>

