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!

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

🍂 Fall into November with a fresh lineup of Community Office Hours, Tech Talks, and Webinars we’ve ...

Transform your security operations with Splunk Enterprise Security

Hi Splunk Community, Splunk Platform has set a great foundation for your security operations. With the ...

Splunk Admins and App Developers | Earn a $35 gift card!

Splunk, in collaboration with ESG (Enterprise Strategy Group) by TechTarget, is excited to announce a ...