Splunk Search

How to remove leading zeros from a numeric value?

pradeepkumarg
Influencer

I have a field on which I am doing ltrim function to remove the leading 0's


eval fieldA = ltrim(fieldA ,"0")

000000104020471991 is being converted to 1.0402e+11. 

How can I get just 104020471991 ?

Tags (3)
1 Solution

icyfeverr
Path Finder

try this:

eval fieldA=ltrim(tostring(fieldA),"0")

View solution in original post

icyfeverr
Path Finder

try this:

eval fieldA=ltrim(tostring(fieldA),"0")

pradeepkumarg
Influencer

Thank you.. overlooked tostring() function 🙂

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...