<?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 the repetative values from row in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194547#M56074</link>
    <description>&lt;P&gt;Could you check if the data is extracted from the rex before doing the stats? Could you post the result&lt;/P&gt;

&lt;P&gt;sourcetype=csv| search 409,1| rex field=_raw "(d+,){2}(?&lt;FIELDID&gt;d+)"|rex field=_raw "(d+,){3}(?&lt;HEADID&gt;d+)"|rex field=_raw "(d+,){44}(?&lt;HEAD_VALUE&gt;d+)"|table headid,fieldid,head_value&lt;/HEAD_VALUE&gt;&lt;/HEADID&gt;&lt;/FIELDID&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:34:59 GMT</pubDate>
    <dc:creator>linu1988</dc:creator>
    <dc:date>2020-09-28T15:34:59Z</dc:date>
    <item>
      <title>Remove the repetative values from row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194544#M56071</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have written a search query which gives the result as below:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/Capture_8.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;my search query is:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;sourcetype=csv| search 409,1| rex field=_raw "(\d+,){2}(?&lt;FIELDID&gt;\d+)"|rex field=_raw "(\d+,){3}(?&lt;HEADID&gt;\d+)"|rex field=_raw "(\d+,){44}(?&lt;HEAD_VALUE&gt;\d+)"| stats list(fieldid) as field_ID, list(headid) as head_ID,list(head_value) as Value|eval Parameter = "parameter_1"|eval hex= "112"|eval bell_id= "33"|fields Parameter hex bell_ID field_ID head_ID Value&lt;/HEAD_VALUE&gt;&lt;/HEADID&gt;&lt;/FIELDID&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;what I want to do is to merge the rows of field_ID and head_ID, if they repeats and sum the "Value" field and show it as single row instead.&lt;BR /&gt;
as below:-&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/Capture2_2.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Please Help...!!!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:34:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194544#M56071</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2020-09-28T15:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the repetative values from row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194545#M56072</link>
      <description>&lt;P&gt;Hello ,&lt;BR /&gt;
If you just add a sum command with all the distinct fields you will get the desired result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=csv| search 409,1| rex field=_raw "(d+,){2}(?&amp;lt;fieldid&amp;gt;d+)"|rex field=_raw "(d+,){3}(?&amp;lt;headid&amp;gt;d+)"|rex field=_raw "(d+,){44}(?&amp;lt;head_value&amp;gt;d+)"| stats sum(head_value) as Value by fieldid,headid |eval Parameter = "parameter_1"|eval hex= "112"|eval bell_id= "33"|fields Parameter hex bell_ID fieldid headid Value|stats list(fieldid) as field_ID,list(headid) as HeadID,list(Value) as Value by Parameter,hex,bell_ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Check if this works for you.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 10:24:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194545#M56072</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-03T10:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the repetative values from row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194546#M56073</link>
      <description>&lt;P&gt;No, it doesn't show any output.&lt;BR /&gt;
No result is seen even after shorting the query as:&lt;/P&gt;

&lt;P&gt;sourcetype=csv| search 409,1| rex field=_raw "(d+,){2}(?&lt;FIELDID&gt;d+)"|rex field=_raw "(d+,){3}(?&lt;HEADID&gt;d+)"|rex field=_raw "(d+,){44}(?&lt;HEAD_VALUE&gt;d+)"| stats sum(head_value) as Value by fieldid,headid&lt;/HEAD_VALUE&gt;&lt;/HEADID&gt;&lt;/FIELDID&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:34:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194546#M56073</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2020-09-28T15:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the repetative values from row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194547#M56074</link>
      <description>&lt;P&gt;Could you check if the data is extracted from the rex before doing the stats? Could you post the result&lt;/P&gt;

&lt;P&gt;sourcetype=csv| search 409,1| rex field=_raw "(d+,){2}(?&lt;FIELDID&gt;d+)"|rex field=_raw "(d+,){3}(?&lt;HEADID&gt;d+)"|rex field=_raw "(d+,){44}(?&lt;HEAD_VALUE&gt;d+)"|table headid,fieldid,head_value&lt;/HEAD_VALUE&gt;&lt;/HEADID&gt;&lt;/FIELDID&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:34:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194547#M56074</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2020-09-28T15:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the repetative values from row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194548#M56075</link>
      <description>&lt;P&gt;I would use &lt;CODE&gt;values&lt;/CODE&gt; instead of &lt;CODE&gt;list&lt;/CODE&gt; in my stats command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=csv 409,1 
| rex field=_raw "(d+,){2}(?&amp;lt;fieldid&amp;gt;d+)"
| rex field=_raw "(d+,){3}(?&amp;lt;headid&amp;gt;d+)"
| rex field=_raw "(d+,){44}(?&amp;lt;head_value&amp;gt;d+)"
| stats values(fieldid) as field_ID, values(headid) as head_ID, sum(head_value) as Value
| eval Parameter = "parameter_1"
| eval hex= "112"
| eval bell_id= "33"
| fields Parameter hex bell_ID field_ID head_ID Value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I don't see a need for the &lt;CODE&gt;search&lt;/CODE&gt; command - you can put that as part of the first search&lt;/P&gt;

&lt;P&gt;But on closer reading, I think this may be what you want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=csv 409,1 
| rex field=_raw "(d+,){2}(?&amp;lt;fieldid&amp;gt;d+)"
| rex field=_raw "(d+,){3}(?&amp;lt;headid&amp;gt;d+)"
| rex field=_raw "(d+,){44}(?&amp;lt;head_value&amp;gt;d+)"
| stats sum(head_value) as sumValue by fieldid headid
| stats list(fieldid) as field_ID, list(headid) as head_ID, list(sumValue) as Value
| eval Parameter = "parameter_1"
| eval hex= "112"
| eval bell_id= "33"
| fields Parameter hex bell_ID field_ID head_ID Value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jan 2014 06:05:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-the-repetative-values-from-row/m-p/194548#M56075</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-01-06T06:05:02Z</dc:date>
    </item>
  </channel>
</rss>

