<?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: Replace letters with numbers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565915#M197186</link>
    <description>&lt;P&gt;Sure, he didn't. But taking into account his desired usage, collisions should be avoided. Otherwise there's no point in this conversion.&lt;/P&gt;&lt;P&gt;As I wrote before, tonumber() gives a very straightforward conversion .&lt;/P&gt;</description>
    <pubDate>Sat, 04 Sep 2021 20:05:43 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-09-04T20:05:43Z</dc:date>
    <item>
      <title>Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565809#M197151</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have an alert that looks for a specific message that includes the record ID.&lt;/P&gt;&lt;P&gt;I would like to be able to create a numeric value for that ID that could be used to create a unique ID when raising a ServiceNow ticket.&amp;nbsp; Therefore, all alerts for the same record ID would write to the same SNow ticket.&lt;/P&gt;&lt;P&gt;The record ID is a string of 7 alphanumerics - e.g. abc4efg&lt;/P&gt;&lt;P&gt;I would like to be able to change "abc4efg" to "1234567".&amp;nbsp; Thus the number does not change, but the letters are all the equivalent 1-26 number.&lt;/P&gt;&lt;P&gt;The only constant is the length of the record ID which is 7 characters.&lt;/P&gt;&lt;P&gt;I've looked at many answers, sadly none provide exactly what I am looking for.&lt;/P&gt;&lt;P&gt;Is this something that could be achieved using SED?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 14:18:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565809#M197151</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-09-03T14:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565827#M197158</link>
      <description>&lt;P&gt;if you're looking to do this in search, then something like this might work - wouldn't be surprised if there was a better way.&amp;nbsp; But essentially an array for each letter, then loop over the recordid and replace letters with associated index of that letter in the letters array&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count 
| eval recordId="abc4efg"
| eval mvRecordId = split(recordId,"")
| eval letters=split("|,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",",")
| eval serviceNowId = mvmap(mvRecordId,if(mvfind(letters,lower(mvRecordId))&amp;gt;0,mvfind(letters,lower(mvRecordId)),mvRecordId))
| eval serviceNowId = mvjoin(serviceNowId,"")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Sep 2021 15:29:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565827#M197158</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2021-09-03T15:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565829#M197160</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190949"&gt;@maciep&lt;/a&gt;&amp;nbsp;, unfortunately our install is still on v7.3.2 so I cannot use 'mvmap'.&amp;nbsp; I will have to push the provider for an upgrade &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 15:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565829#M197160</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-09-03T15:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565834#M197163</link>
      <description>&lt;P&gt;Try this rex command out, you'll need to go up to z of course:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| makeresults 1&lt;BR /&gt;| eval your_field="abc4ef"&lt;BR /&gt;| rex mode=sed field=your_field "s/a/1/g s/b/2/g s/c/3/g s/e/5/g s/f/6/g"&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 15:55:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565834#M197163</guid>
      <dc:creator>cmtri</dc:creator>
      <dc:date>2021-09-03T15:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565859#M197167</link>
      <description>&lt;P&gt;Why '"generate" if you can use the value directly?&lt;/P&gt;&lt;PRE&gt;| eval myID=tonumber(yourID,36)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Unless you want to have 7 digits at most. In this case good luck avoiding colisions &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 20:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565859#M197167</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-03T20:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565898#M197179</link>
      <description>&lt;P&gt;Based on&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190949"&gt;@maciep&lt;/a&gt;&amp;nbsp; solution, here is one that doesn't use mvmap&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval recordId="abc4efg"
| eval mvRecordId = split(recordId,"")
| eval letters=split("|,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",",")
| eval serviceNowId=""
| foreach 1 2 3 4 5 6 7
    [| eval letter=mvindex(mvRecordId,&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;-1)
    | eval serviceNowId=mvappend(serviceNowId,if(mvfind(letters,lower(letter))&amp;gt;0,tostring(mvfind(letters,lower(letter))),letter))]
| fields - letter letters mvRecordId
| eval serviceNowId = mvjoin(serviceNowId,"")&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 04 Sep 2021 09:51:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565898#M197179</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-04T09:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565913#M197184</link>
      <description>&lt;P&gt;This solution is prone to collision.&lt;/P&gt;&lt;P&gt;How do you distinguish "akakaka" from "kakakaa"? Or "111aaa1" from "1a1aa1a"?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 18:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565913#M197184</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-04T18:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565914#M197185</link>
      <description>&lt;P&gt;Correct - but the OP doesn't specify how this should be avoided. There are a couple of ways this might be done. The indexes could be prefixed with a leading zero or two, the values could be joined with zeroes or nines or some other digit.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 19:08:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565914#M197185</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-04T19:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565915#M197186</link>
      <description>&lt;P&gt;Sure, he didn't. But taking into account his desired usage, collisions should be avoided. Otherwise there's no point in this conversion.&lt;/P&gt;&lt;P&gt;As I wrote before, tonumber() gives a very straightforward conversion .&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 20:05:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/565915#M197186</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-04T20:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Replace letters with numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/566002#M197224</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;, I had tried using&amp;nbsp;&amp;nbsp;"eval myId=tonumber(recordId,26)" not realising I had to use base 36 to include 0-9.&lt;/P&gt;&lt;P&gt;I am using strftime on the date and combining the date and recordId to give me one SNow ID per day for each record.&lt;/P&gt;&lt;P&gt;This gives me the solution I require.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 10:24:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Replace-letters-with-numbers/m-p/566002#M197224</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-09-06T10:24:14Z</dc:date>
    </item>
  </channel>
</rss>

