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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...