<?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 replace letters with numbers in a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275644#M83149</link>
    <description>&lt;P&gt;I don't think I would be able to do it since I'm using Web Splunk and have no access to commands.conf. I'm pretty sure one can do it with rex sed, but my level of expertise is not sufficient and I couldn't find any examples that would suit my need.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 12:57:24 GMT</pubDate>
    <dc:creator>wsadowy1</dc:creator>
    <dc:date>2016-09-13T12:57:24Z</dc:date>
    <item>
      <title>How to replace letters with numbers in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275642#M83147</link>
      <description>&lt;P&gt;I'm trying to convert a long hexadecimal number (md5) to decimal.&lt;BR /&gt;
Unfortunately md5_number = tonumber(md5_string,16) does not seem to work, perhaps due to the number's length.&lt;BR /&gt;
So I thought I would replace respective letters in the md5 string with numbers. "a" to 10, "b" to 11 ... "f" to 16. The correctness of the final number does not play a role as I only need it to compare two neighboring events using "delta" function, so I need decimal numbers for that purpose.&lt;BR /&gt;
Unfortunately I am unable to do it using replace or rex in sed mode.&lt;BR /&gt;
Example md5 hash:  6c17f73c47a12dcf494cd95e3e8bd490&lt;BR /&gt;
Any help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:57:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275642#M83147</guid>
      <dc:creator>wsadowy1</dc:creator>
      <dc:date>2020-09-29T10:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace letters with numbers in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275643#M83148</link>
      <description>&lt;P&gt;Try creating a custom command and implement your own logic in python to achieve your requirement &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.8/AdvancedDev/SearchScripts"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.8/AdvancedDev/SearchScripts&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 12:53:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275643#M83148</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2016-09-13T12:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace letters with numbers in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275644#M83149</link>
      <description>&lt;P&gt;I don't think I would be able to do it since I'm using Web Splunk and have no access to commands.conf. I'm pretty sure one can do it with rex sed, but my level of expertise is not sufficient and I couldn't find any examples that would suit my need.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 12:57:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275644#M83149</guid>
      <dc:creator>wsadowy1</dc:creator>
      <dc:date>2016-09-13T12:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace letters with numbers in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275645#M83150</link>
      <description>&lt;P&gt;A crude way, but should work&lt;BR /&gt;
(splitting first 8 characters and converting to number and then next 8 chars and converting and then concatenating both)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count as echo | eval decimal = tostring(tonumber(substr("D431F2404CA13E22594E5C8B04D3BBB8",1,8),16)) + tostring(tonumber(substr("D431F2404CA13E22594E5C8B04D3BBB8",9,8),16))| fields decimal
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275645#M83150</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2016-09-13T15:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace letters with numbers in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275646#M83151</link>
      <description>&lt;P&gt;Thanks!&lt;BR /&gt;
I actually managed to achieve my goal by writing a rather lenghty nested replace function:&lt;BR /&gt;
tonumber(replace(replace(replace(replace(replace(replace(log_msg_hash,"a","10"),"b","11"),"c","12"),"d","13"),"e","14"),"f","15"))&lt;BR /&gt;
It doesn't calculate the number properly but it does create SOME decimal number which primarly was my goal.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:00:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-letters-with-numbers-in-a-string/m-p/275646#M83151</guid>
      <dc:creator>wsadowy1</dc:creator>
      <dc:date>2020-09-29T11:00:49Z</dc:date>
    </item>
  </channel>
</rss>

