Splunk Search

Capitalize the first character of a string value using eval or field format?

atornes
Path Finder

How can I capitalize the first character of some string values using one of the eval or fieldformat operators?

Tags (3)
1 Solution

Ayn
Legend

Off the top of my head (I have no Splunk instance to try this on at the moment), this should do it:

... | eval myfield = upper(substr(myfield,1,1)).substr(myfield,2)

View solution in original post

Ayn
Legend

Off the top of my head (I have no Splunk instance to try this on at the moment), this should do it:

... | eval myfield = upper(substr(myfield,1,1)).substr(myfield,2)

scentoni_splunk
Splunk Employee
Splunk Employee

Try this

| eval myfield = upper(substr(myfield,1,1)).lower(substr(myfield,2))
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...