<?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 Subtracting column when column name are dynamic in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-column-when-column-name-are-dynamic/m-p/511303#M143290</link>
    <description>&lt;P&gt;Hello World.&lt;/P&gt;&lt;P&gt;I have a splunk search which results in the below table...&lt;/P&gt;&lt;TABLE border="0" width="254px" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;Col1&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;Col2&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;Col3&lt;/TD&gt;&lt;TD width="47px"&gt;Col4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;Row1&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="47px"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;Row2&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="47px"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;Row3&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="47px"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My need now is to subtract Col2 - Col1, Col3 - Col2, Col4 - Col3.&lt;/P&gt;&lt;P&gt;Please note the name of the column are not static, they differ depending on the search, and have the potential to be around 40 different values.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 11:12:42 GMT</pubDate>
    <dc:creator>kiamyash</dc:creator>
    <dc:date>2020-07-28T11:12:42Z</dc:date>
    <item>
      <title>Subtracting column when column name are dynamic</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-column-when-column-name-are-dynamic/m-p/511303#M143290</link>
      <description>&lt;P&gt;Hello World.&lt;/P&gt;&lt;P&gt;I have a splunk search which results in the below table...&lt;/P&gt;&lt;TABLE border="0" width="254px" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;Col1&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;Col2&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;Col3&lt;/TD&gt;&lt;TD width="47px"&gt;Col4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;Row1&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="47px"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;Row2&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="47px"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="55px" height="14px"&gt;Row3&lt;/TD&gt;&lt;TD width="50px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="51px" height="14px"&gt;X&lt;/TD&gt;&lt;TD width="47px"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My need now is to subtract Col2 - Col1, Col3 - Col2, Col4 - Col3.&lt;/P&gt;&lt;P&gt;Please note the name of the column are not static, they differ depending on the search, and have the potential to be around 40 different values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 11:12:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-column-when-column-name-are-dynamic/m-p/511303#M143290</guid>
      <dc:creator>kiamyash</dc:creator>
      <dc:date>2020-07-28T11:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting column when column name are dynamic</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-column-when-column-name-are-dynamic/m-p/511342#M143298</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224182"&gt;@kiamyash&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"your current search" 
|eval _prev=0
|foreach * [eval diff_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; =&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; - _prev |  eval _prev=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will create additional fields with diff as prefix.&lt;/P&gt;&lt;P&gt;If you dont want extra field and want to replace values in existing field, replace&amp;nbsp;diff_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; with just&amp;nbsp;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;Please note , you have to use "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" string. Its not the replacement of your field name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 13:50:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-column-when-column-name-are-dynamic/m-p/511342#M143298</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-07-28T13:50:49Z</dc:date>
    </item>
  </channel>
</rss>

