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!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...