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, an upvote would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...