Splunk Search

Can I make a calculated field by regex replace on an existing field?

hylam
Contributor

Can I make this happen automatically? I know I can do it with the rex search command.

eval newField=sed(oldField, "s/aa/bb/g")

woodcock
Esteemed Legend

You can do this in search:

... |eval newField = oldField | rex field=oldField mode=sed "s/aa/bb/"
0 Karma

hylam
Contributor

The regex replace has to work AUTOMATICALLY w/o adding anything to the query.

0 Karma

woodcock
Esteemed Legend

Did you try it?

0 Karma

hylam
Contributor

oh i have just found it
replace(X,Y,Z)
http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/CommonEvalFunctions

my next question is can i perform the replace w/o the /g?

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...