Splunk Search

regex to replace numeric value as astreik

DataOrg
Builder

i want search search level field extraction command to replace all numeric value as astriek

Name = Dell vostro 2012 laptop wireless
Name = HP latitude laptop 20161 home station
Name is the field followd by value

I want results as
Name = Dell vostro **** laptop wireless
Name = HP latitude laptop **** home station

0 Karma
1 Solution

jpolvino
Builder

If you want to get rid of numbers, you can use sed to replace them with nothing (also removes leading space):

(your search)
| rex field=Name mode=sed "s/\s\d+//g" 

You said replace with asterisk, I believe, which would be:

(your search)
| rex field=Name mode=sed "s/\s\d+/\*/g"

View solution in original post

jpolvino
Builder

If you want to get rid of numbers, you can use sed to replace them with nothing (also removes leading space):

(your search)
| rex field=Name mode=sed "s/\s\d+//g" 

You said replace with asterisk, I believe, which would be:

(your search)
| rex field=Name mode=sed "s/\s\d+/\*/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 ...