Splunk Search

How to convert version number to numerical value

splunkyj
Path Finder

How do I convert the following string value to a numerical value that represents two digits between the dots?

version = 7.10.23.1

I would like for this to be converted to a numeric value:

version = 07102301

The zero before the 7, does not need to show. I just need to be able to perform <> conditional or comparison functions. I appreciate your help. 

 

Labels (1)
0 Karma
1 Solution

to4kawa
Ultra Champion
| makeresults
| eval version = "7.10.23.1"
| rex field=version mode=sed  "s/\b(\d)\b/0\1/g s/\.//g"

View solution in original post

to4kawa
Ultra Champion
| makeresults
| eval version = "7.10.23.1"
| rex field=version mode=sed  "s/\b(\d)\b/0\1/g s/\.//g"

splunkyj
Path Finder

This worked beautiful!! lol. I tested various numbers, and all tested consistent. Thank you so much @to4kawa 

0 Karma
Get Updates on the Splunk Community!

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...

Splunk AppDynamics Agents Webinar Series

Mark your calendars! On June 24th at 12PM PST, we’re going live with the second session of our Splunk ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...