Knowledge Management

How do you remove the first letter of a value?

brienhawker
Explorer

I have a list of usernames of varying lengths. I just need to have the first letter of each username removed. Im guessing it has something to do with ltrim but I dont know what to put in to remove the first random character.

0 Karma
1 Solution

vnravikumar
Champion

Hi

try this

|makeresults |eval msg="sample" | eval result =replace(msg,"^.","")

View solution in original post

VatsalJagani
SplunkTrust
SplunkTrust

Hi @brienhawker,

 .... | eval new_username=substr(username, 1)

vnravikumar
Champion

Hi

try this

|makeresults |eval msg="sample" | eval result =replace(msg,"^.","")

woodcock
Esteemed Legend

Yes, ltrim can do it but get used to using sed like this:

... | rex field=username mode=sed "s/^.//"
Get Updates on the Splunk Community!

Cultivate Your Career Growth with Fresh Splunk Training

Growth doesn’t just happen—it’s nurtured. Like tending a garden, developing your Splunk skills takes the right ...

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering.  Because we’ve ...

How to Send Splunk Observability Alerts to Webex teams in Minutes

As a Developer Evangelist at Splunk, my team and I are constantly tinkering with technology to explore its ...