<?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: Trying to combine data within the same table under certain conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670258#M229788</link>
    <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;. Works like a charm.&lt;/P&gt;&lt;P&gt;Sorry I am pretty newbie in splunk and did not even know the existence of command makeresults&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;One short question, could this be do more flexible? I mean, if columns are named like&lt;/P&gt;&lt;P&gt;A1 B1 A2 B2 A3 B3 instead of A B C D E F&lt;/P&gt;&lt;P&gt;is there a way to make this in a "loop"? I tried foreach, but appendpipe cannot be used within a foreach statement.&lt;/P&gt;&lt;P&gt;Thanks a lot for your time.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Nov 2023 07:15:54 GMT</pubDate>
    <dc:creator>Jimenez</dc:creator>
    <dc:date>2023-11-30T07:15:54Z</dc:date>
    <item>
      <title>Trying to combine data within the same table under certain conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670127#M229770</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;First of all thank you for your time. I am quite new to splunk and I am struggling with this issue for some time but it seems quite more challenging than I initially expected.&lt;/P&gt;&lt;P&gt;I have this following sample data in tabular form:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%"&gt;A&lt;/TD&gt;&lt;TD width="20%"&gt;B&lt;/TD&gt;&lt;TD width="20%"&gt;C&lt;/TD&gt;&lt;TD width="20%"&gt;D&lt;/TD&gt;&lt;TD width="10%"&gt;E&lt;/TD&gt;&lt;TD width="10%"&gt;F&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.1&lt;/TD&gt;&lt;TD width="20%"&gt;b1&lt;/TD&gt;&lt;TD width="20%"&gt;0.1&lt;/TD&gt;&lt;TD width="20%"&gt;d1&lt;/TD&gt;&lt;TD width="10%"&gt;0.1&lt;/TD&gt;&lt;TD width="10%"&gt;f1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.11&lt;/TD&gt;&lt;TD width="20%"&gt;b2&lt;/TD&gt;&lt;TD width="20%"&gt;0.2&lt;/TD&gt;&lt;TD width="20%"&gt;d2&lt;/TD&gt;&lt;TD width="10%"&gt;0.35&lt;/TD&gt;&lt;TD width="10%"&gt;f2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.2&lt;/TD&gt;&lt;TD width="20%"&gt;b3&lt;/TD&gt;&lt;TD width="20%"&gt;0.3&lt;/TD&gt;&lt;TD width="20%"&gt;d3&lt;/TD&gt;&lt;TD width="10%"&gt;0.9&lt;/TD&gt;&lt;TD width="10%"&gt;f3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.22&lt;/TD&gt;&lt;TD width="20%"&gt;b4&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;1.0&lt;/TD&gt;&lt;TD width="10%"&gt;f4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;0.4&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;b5&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.5&lt;/TD&gt;&lt;TD width="20%"&gt;b6&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.55&lt;/TD&gt;&lt;TD width="20%"&gt;b7&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;0.9&lt;/TD&gt;&lt;TD width="20%"&gt;b8&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I need to generate something like:&lt;/P&gt;&lt;TABLE border="1" width="100.00000000000001%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;B&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;C&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;D&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;E&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;F&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;d1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.1&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;f1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.11&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b2&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.2&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b3&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.2&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;d2&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.22&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b4&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&lt;U&gt;&lt;STRONG&gt;0.3&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&lt;P&gt;0.3&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;d3&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&lt;U&gt;&lt;STRONG&gt;0.35&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.35&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;f2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&lt;P&gt;0.4&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;b5&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.5&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b6&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.55&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b7&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.9&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;b8&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;0.9&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;f3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;U&gt;&lt;STRONG&gt;1.0&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1.0&lt;/TD&gt;&lt;TD&gt;f4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, first I need to merge column A with C and E sorted and then I need to make columns C and E match with column A including data in columns D and F respectively.&lt;/P&gt;&lt;P&gt;I guess there is an easy way to achieve this. I have tried with joins but I cannot make it work.&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 09:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670127#M229770</guid>
      <dc:creator>Jimenez</dc:creator>
      <dc:date>2023-11-29T09:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to combine data within the same table under certain conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670152#M229776</link>
      <description>&lt;P&gt;It looks like your sample data has been created with a couple of appendcols. If this is the case, perhaps it would be easier to go back a step and try and create your desired output from the original searches?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 11:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670152#M229776</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-29T11:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to combine data within the same table under certain conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670154#M229777</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Actually I created the data by hand to kind of simplify the actual situation. Data is unfortunately sensitive and I cannot show too much. I did not use any appendcol for the actual data but eval with if conditions. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 11:47:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670154#M229777</guid>
      <dc:creator>Jimenez</dc:creator>
      <dc:date>2023-11-29T11:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to combine data within the same table under certain conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670166#M229779</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="A,B,C,D,E,F
0.1,b1,0.1,d1,0.1,f1
0.11,b2,0.2,d2,0.35,f2
0.2,b3,0.3,d3,0.9,f3
0.22,b4,,,1.0,f4
0.4,b5
0.5,b6
0.55,b7
0.9,b8"
| table A B C D E F
``` The lines above create dummy event data in line with your example (it is often helpful if you had provided this yourself) ```
| appendpipe
    [| rename A as a
    | rename B as b
    | eval C=null()
    | eval D=null()
    | eval E=null()
    | eval F=null()]
| fields - A B
| appendpipe
    [| where isnotnull(C)
    | eval A=null()
    | eval B=null()
    | eval a=C
    | rename C as c
    | rename D as d
    | eval E=null()
    | eval F=null()]
| fields - C D
| appendpipe
    [| where isnotnull(E)
    | eval A=null()
    | eval B=null()
    | eval C=null()
    | eval D=null()
    | eval a=E
    | rename E as e
    | rename F as f]
| fields - E F
| where isnotnull(a)
| stats values(*) as * by a
| rename a as A
| rename b as B
| rename c as C
| rename d as D
| rename e as E
| rename f as F&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Nov 2023 12:29:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670166#M229779</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-29T12:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to combine data within the same table under certain conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670258#M229788</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;. Works like a charm.&lt;/P&gt;&lt;P&gt;Sorry I am pretty newbie in splunk and did not even know the existence of command makeresults&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;One short question, could this be do more flexible? I mean, if columns are named like&lt;/P&gt;&lt;P&gt;A1 B1 A2 B2 A3 B3 instead of A B C D E F&lt;/P&gt;&lt;P&gt;is there a way to make this in a "loop"? I tried foreach, but appendpipe cannot be used within a foreach statement.&lt;/P&gt;&lt;P&gt;Thanks a lot for your time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 07:15:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670258#M229788</guid>
      <dc:creator>Jimenez</dc:creator>
      <dc:date>2023-11-30T07:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to combine data within the same table under certain conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670271#M229790</link>
      <description>&lt;P&gt;Yes, you can use different column names&lt;/P&gt;&lt;P&gt;No, I don't think this method can be done in a loop, however, there may be other ways to solve this which might be applied in a loop, but it may depend on the column names and the relationship between the pairs of column names, e.g. A and A1, B and B1, etc.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 09:16:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-combine-data-within-the-same-table-under-certain/m-p/670271#M229790</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-30T09:16:02Z</dc:date>
    </item>
  </channel>
</rss>

