<?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 convert this string to a numeric value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260335#M78048</link>
    <description>&lt;P&gt;You can use your original regex and add the convert command as specified in the answer.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2016 16:32:17 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-07-15T16:32:17Z</dc:date>
    <item>
      <title>How to convert this string to a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260331#M78044</link>
      <description>&lt;P&gt;I've created a new field, however, it's appearing as a string instead of a value. I've used the regular expression to extract from the following data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?=[^T]*(?:Transfer complete.|T.*Transfer complete.))^[^\.\n]*\.\s+(?P\d+,\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Transfer complete. 1,011 bytes transferred&lt;/P&gt;

&lt;P&gt;Therefore building a result of 1,011, however, this is considered a string rather than a numeric value. How can I convert this to treat the result as a numeric value?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 19:04:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260331#M78044</guid>
      <dc:creator>abutler1</dc:creator>
      <dc:date>2016-07-14T19:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260332#M78045</link>
      <description>&lt;P&gt;Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval x="Transfer complete. 1,011 bytes transferred" | rex field=x "complete\.\s?(?&amp;lt;b&amp;gt;[^\s]+)" | table b | convert num(b) as bn
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jul 2016 19:15:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260332#M78045</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-14T19:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260333#M78046</link>
      <description>&lt;P&gt;Apoliges, im a newbie at this and entered the above into the regular expression&lt;BR /&gt;
it's providing null as a result, the value of bytes transferred will range from line to line&lt;/P&gt;

&lt;P&gt;Original Source Line&lt;/P&gt;

&lt;P&gt;[21] Thu 14Jul16 14:17:15 - (014058) 226 Transfer complete. 1,011 bytes transferred. 30.85 KB/sec.&lt;/P&gt;

&lt;P&gt;Result was null&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 11:40:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260333#M78046</guid>
      <dc:creator>abutler1</dc:creator>
      <dc:date>2016-07-15T11:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260334#M78047</link>
      <description>&lt;P&gt;As long as the bytes is has &lt;CODE&gt;complete.&lt;/CODE&gt; before it, this regex will capture all combinations. So you search will look like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=x "complete\.\s?(?&amp;lt;bytes&amp;gt;[^\s]+)\sbytes" | convert num(bytes) as bytes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Jul 2016 16:03:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260334#M78047</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-15T16:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260335#M78048</link>
      <description>&lt;P&gt;You can use your original regex and add the convert command as specified in the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 16:32:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-numeric-value/m-p/260335#M78048</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-15T16:32:17Z</dc:date>
    </item>
  </channel>
</rss>

