Splunk Search

How to replace slash characters in field values with spaces instead (ex: change "A/B/C/D" to "A B C D")?

arnabsen1234
New Member

I have a field named httpUrl. This field has values with slashes like "/document/import/upload/reload/". I want to replace all the slashes with spaces. So the final thing should look like httpUrl="document import upload reload". How do I achieve this?

Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try ... | eval httpUrl=replace (httpUrl,"/"," ") | ...

---
If this reply helps you, Karma would be appreciated.

MuS
Legend

Hi arnabsen1234,

try something like this:

| gentimes start=-1 | eval httpUrl="document/import/upload/reload" | rex field=httpUrl mode=sed "s/\// /g"

cheers, MuS

Get Updates on the Splunk Community!

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...