Splunk Search

How to remove or replace "-" from a field)?

hellothere
Engager

Hello all, 

I have a field that contains hypens in the value.  For example, 20.0--(1259). 

I am simply trying to replace it with space, but it does not work.  could you tell me what am I doing wrong? 

 

index=main
| eval version_name = replace(version, "-", "  ")

Labels (4)
Tags (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Your code looks OK - unless your real field name has special characters in - in which case, put it in single quotes.

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your code looks OK - unless your real field name has special characters in - in which case, put it in single quotes.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Please explain what you mean by "it does not work".  Your code works fine in my Splunk sandbox.  "20.0--(1259)" becomes "20.0 (1259)".

---
If this reply helps you, Karma would be appreciated.
0 Karma
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 ...