<?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 parse the British Pound £ sign for currency fields? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294522#M55957</link>
    <description>&lt;P&gt;@splunkuser_uk - Were you able to test out gokadroid's second possible solution? Did it work? If yes, please don't forget to resolve this post by clicking on "Accept". If you still need more help, please provide a comment with some feedback. Thanks!&lt;/P&gt;</description>
    <pubDate>Sun, 12 Mar 2017 22:14:41 GMT</pubDate>
    <dc:creator>aaraneta_splunk</dc:creator>
    <dc:date>2017-03-12T22:14:41Z</dc:date>
    <item>
      <title>How to parse the British Pound £ sign for currency fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294518#M55953</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm relatively new to Splunk and trying to ingest a cav of transactions in GBP in the format £123.45. I have these in a CSV and ideally want them formatted as currency so that I can analyze in Splunk. When the CSV is ingested the fields are displayed as a string not recognizing the £ sign - I've tried various convert options including (auto) and num but not having much luck.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 18:54:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294518#M55953</guid>
      <dc:creator>splunkuser_uk</dc:creator>
      <dc:date>2017-02-10T18:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse the British Pound £ sign for currency fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294519#M55954</link>
      <description>&lt;P&gt;How about trying this and see if it works out, assuming string is coming in &lt;CODE&gt;currency&lt;/CODE&gt; field as &lt;CODE&gt;£ 42&lt;/CODE&gt; or &lt;CODE&gt;£ 42.0&lt;/CODE&gt; or &lt;CODE&gt;£42&lt;/CODE&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base query to return your currency field
| rex field=currency "£\s*(?&amp;lt;myCurrency&amp;gt;.*)"
| fieldformat myCurency="£".tostring(myCurrency, "commas")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.2/SearchReference/Fieldformat#Example_3:"&gt;See example here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 08:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294519#M55954</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2017-02-11T08:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse the British Pound £ sign for currency fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294520#M55955</link>
      <description>&lt;P&gt;Hi - thanks for your reply. I tried your suggestion but not having much luck. The problem is the fields in the CSV which contain a currency amount i.e   the figure £1,838.38 are being ingested as \xA31,838.38 - the £ symbol is ingested as \xA3 rather than a "£"&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2017 20:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294520#M55955</guid>
      <dc:creator>splunkuser_uk</dc:creator>
      <dc:date>2017-02-12T20:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse the British Pound £ sign for currency fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294521#M55956</link>
      <description>&lt;P&gt;Assuming as per your comments if string &lt;CODE&gt;£1,838.38&lt;/CODE&gt; is coming in &lt;CODE&gt;currency&lt;/CODE&gt; field as &lt;CODE&gt;\xA31,838.38&lt;/CODE&gt; then how about trying this:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Ensure &lt;CODE&gt;currency&lt;/CODE&gt; has no commas to start with (if any)&lt;/LI&gt;
&lt;LI&gt;Extract everything after &lt;CODE&gt;\xA3&lt;/CODE&gt; from &lt;CODE&gt;currency&lt;/CODE&gt; field into a new field &lt;CODE&gt;myCurrency&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Format back &lt;CODE&gt;myCurrency&lt;/CODE&gt; to use the &lt;CODE&gt;£ symbol&lt;/CODE&gt; as a string.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Try below search which shall give you the results needed as stated above.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base query to return your currency field
 | rex field=currency mode=sed "s/,//g"
 | rex field=currency "A3(?&amp;lt;myCurrency&amp;gt;.*)"
 | fieldformat myCurrency ="£".tostring(myCurrency , "commas") 
 | stats sum(myCurrency )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope it helps. Below is the sample &lt;CODE&gt;makeresults&lt;/CODE&gt; command i used to verify it was working.&lt;BR /&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/2474i3A5415F5FED7AA76/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 06:24:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294521#M55956</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2017-02-13T06:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse the British Pound £ sign for currency fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294522#M55957</link>
      <description>&lt;P&gt;@splunkuser_uk - Were you able to test out gokadroid's second possible solution? Did it work? If yes, please don't forget to resolve this post by clicking on "Accept". If you still need more help, please provide a comment with some feedback. Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2017 22:14:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-the-British-Pound-sign-for-currency-fields/m-p/294522#M55957</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-03-12T22:14:41Z</dc:date>
    </item>
  </channel>
</rss>

