Splunk Search

Replace '&' with ','

Jananee_iNautix
Path Finder

I want to replace the character '&' with the character ',' in the below field.

field = {call DB2GIPS.GIP_IP_SMRY_BROWSE(?& ?& ?& ?& ?& ?)},4,145.20738080143929,65.47478818893433,360.34633181989193,580.8295232057571,,2.2596316800361542E-4,,0.0

so that the result should be

field = {call DB2GIPS.GIP_IP_SMRY_BROWSE(?, ?, ?, ?, ?, ?)},4,145.20738080143929,65.47478818893433,360.34633181989193,580.8295232057571,,2.2596316800361542E-4,,0.0

How can that be done in splunk?Please advice.

Tags (1)
0 Karma

chimell
Motivator
Hi 
Try this request :
      enter something here |field = {call DB2GIPS.GIP_IP_SMRY_BROWSE(?& ?& ?& ?& ?& ?)},4,145.20738080143929,65.47478818893433,360.34633181989193,580.8295232057571,,2.2596316800361542E-4,,0.0 | replace "(?& ?& ?& ?& ?& ?) "  with "(?, ?, ?, ?, ?, ?)" in field
0 Karma

David
Splunk Employee
Splunk Employee

Easily:

rex mode=sed "s/&/,/g"

Does that work for you?

ramdaspr
Contributor

you also should specify the field name you want to rex or it might mangle up the rest of the raw data as well..
so rex field=myfieldname mode=sed "s/&/,/g"

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 ...