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!

Splunk Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...