<?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 do a group by on regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347161#M102781</link>
    <description>&lt;P&gt;I modified it a bit to &lt;BR /&gt;
mode=sed "s/\d{4}-\d{2}-\d{2}//"&lt;BR /&gt;
And it started working. &lt;BR /&gt;
Cool thanks&lt;/P&gt;</description>
    <pubDate>Tue, 13 Mar 2018 12:53:58 GMT</pubDate>
    <dc:creator>utkarshpujari</dc:creator>
    <dc:date>2018-03-13T12:53:58Z</dc:date>
    <item>
      <title>How to do a group by on regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347159#M102779</link>
      <description>&lt;P&gt;I have a certain field which contains the location of a file. The filepath looks like this /some/path//some.csv. I want to group my results based on the file paths that match except the date condition. For example&lt;/P&gt;

&lt;P&gt;Field1 &lt;BR /&gt;
 /a/b/c/2016-01-01/abc.csv&lt;BR /&gt;
  /x/y/z/2016-01-01/xyz.csv&lt;BR /&gt;
  /a/b/c/2016-01-02/abc.csv&lt;BR /&gt;
  /x/y/z/2016-01-02/xyz.csv&lt;BR /&gt;
  /a/b/c/2016-01-03/abc.csv&lt;BR /&gt;
  /x/y/z/2016-01-03/xyz.csv&lt;/P&gt;

&lt;P&gt;I want something like this if I were to do a count&lt;BR /&gt;
/a/b/c/*/abc.csv 3&lt;BR /&gt;
/x/y/z/*/xyz.csv  3&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 11:22:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347159#M102779</guid>
      <dc:creator>utkarshpujari</dc:creator>
      <dc:date>2018-03-13T11:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a group by on regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347160#M102780</link>
      <description>&lt;P&gt;First, create the regex - IMO sedmode - to remove the date piece.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=Field1 mode=sed "/\d{4}-\d{2}-\/d{2}//"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, that shoudl remove the &lt;EM&gt;first&lt;/EM&gt; piece that looks like a date from Field1.  NOTE if you need to use this full date field later in this search, you won't be able to do it this way.  But don't worry, this doesn't actually change the field in the data itself, so your next searches will be fine, it's just changing it for the remainder of &lt;EM&gt;this&lt;/EM&gt; search.&lt;/P&gt;

&lt;P&gt;Then let's just stats count them...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count by Field1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should do it - give it a try and let us know if it works or what it does wrong if it's not right!&lt;/P&gt;

&lt;P&gt;for a single-pasting - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search...
| rex field=Field1 mode=sed "/\d{4}-\d{2}-\/d{2}//"
| stats count by Field1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Happy Splunking,&lt;BR /&gt;
Rich&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 11:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347160#M102780</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2018-03-13T11:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a group by on regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347161#M102781</link>
      <description>&lt;P&gt;I modified it a bit to &lt;BR /&gt;
mode=sed "s/\d{4}-\d{2}-\d{2}//"&lt;BR /&gt;
And it started working. &lt;BR /&gt;
Cool thanks&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 12:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347161#M102781</guid>
      <dc:creator>utkarshpujari</dc:creator>
      <dc:date>2018-03-13T12:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a group by on regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347162#M102782</link>
      <description>&lt;P&gt;Accept an answer : ) &lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 03:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-group-by-on-regex/m-p/347162#M102782</guid>
      <dc:creator>ryhluc01</dc:creator>
      <dc:date>2019-02-05T03:13:44Z</dc:date>
    </item>
  </channel>
</rss>

