<?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: I am trying to subtract one column from another and want to do it for other columns as well by using foreach in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340941#M165463</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=1 | tabel Column* Total
 | foreach Column* [ | eval "Answer&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"=Total-'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;']
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 01 Nov 2017 14:36:09 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-11-01T14:36:09Z</dc:date>
    <item>
      <title>I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340938#M165460</link>
      <description>&lt;P&gt;My data is like this&lt;BR /&gt;
Column1 Column2 Column3 Total&lt;/P&gt;

&lt;P&gt;I am using the below command&lt;BR /&gt;
&lt;STRONG&gt;|foreach Column* [ eval Answer &amp;lt;&amp;gt; = Total - &amp;lt;&amp;gt; ]&lt;BR /&gt;
|table Column1, Column2, Column3 Answer1, Answer2, Answer3&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;but I getting the below error&lt;BR /&gt;
&lt;EM&gt;Error in 'foreach' command: The last argument must be a search pipeline&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3761i4D7260DB9E6B1968/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Kindly Help me with this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 12:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340938#M165460</guid>
      <dc:creator>nkankur</dc:creator>
      <dc:date>2017-11-01T12:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340939#M165461</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=1 | tabel Column* Total
| foreach Column* [ eval Answer&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;=Total-&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 13:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340939#M165461</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-01T13:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340940#M165462</link>
      <description>&lt;P&gt;I am still getting the error as given below,&lt;/P&gt;

&lt;P&gt;No results found.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 14:33:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340940#M165462</guid>
      <dc:creator>nkankur</dc:creator>
      <dc:date>2017-11-01T14:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340941#M165463</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=1 | tabel Column* Total
 | foreach Column* [ | eval "Answer&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"=Total-'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;']
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 14:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340941#M165463</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-01T14:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340942#M165464</link>
      <description>&lt;P&gt;Thanks a lot for your support but still getting the same error.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 14:57:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340942#M165464</guid>
      <dc:creator>nkankur</dc:creator>
      <dc:date>2017-11-01T14:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340943#M165465</link>
      <description>&lt;P&gt;Strange. The same syntax works for me. See this runanywhere search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval Column1=10 | eval Column2=20 | eval Column3=30 | table Column* | addtotals 
| foreach Column* [eval "Answer&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"=Total-'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;']
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If above works for you, please check closely if there is syntax error on your side (no extra space or anything).&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 15:08:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340943#M165465</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-01T15:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340944#M165466</link>
      <description>&lt;P&gt;Yes your code is working just fine, but I am still stuck. I will share the code which I am using,Please guide me if there is any error in that.&lt;/P&gt;

&lt;P&gt;When I am using below command it is showing data.&lt;/P&gt;

&lt;P&gt;| table V* Voice&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 09:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340944#M165466</guid>
      <dc:creator>nkankur</dc:creator>
      <dc:date>2017-11-02T09:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to subtract one column from another and want to do it for other columns as well by using foreach</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340945#M165467</link>
      <description>&lt;P&gt;V1        V2   V3   Voice&lt;BR /&gt;
1000    0   0   1000&lt;BR /&gt;
1000    0   0   1200&lt;BR /&gt;
1000    0   0   1300    &lt;/P&gt;

&lt;P&gt;But after the below command it is showing no results.&lt;BR /&gt;
| table V* Voice&lt;BR /&gt;
| foreach V* [ eval "Answer&amp;lt;&amp;gt;"=Voice-'&amp;lt;&amp;gt;']&lt;/P&gt;

&lt;P&gt;No Results&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 09:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-am-trying-to-subtract-one-column-from-another-and-want-to-do/m-p/340945#M165467</guid>
      <dc:creator>nkankur</dc:creator>
      <dc:date>2017-11-02T09:31:03Z</dc:date>
    </item>
  </channel>
</rss>

