Getting Data In

Field Parsing Address for Numbers

phandnny
Engager

I'm fairly new to Splunk. I have a field (address). How can I parse just the all numbers from an address line to a new field (so I can list it later in a table) ?

i.e. 123 W Smith St #1

Would become:

1231

0 Karma

vnravikumar
Champion

Hi

Try this also

| makeresults 
| eval address ="123 W Smith St #1" 
| rex field=address max_match=0 "(?P<result>[0-9]+)" 
| eval result= replace(tostring(result),"\s","") 
| table address result
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This should do it.

... | eval numbers=address | rex field=numbers mode=sed "s/(\D)//g"
---
If this reply helps you, Karma would be appreciated.

martin_mueller
SplunkTrust
SplunkTrust

Yeah, many roads lead to this particular Rome. Another one:

... | eval numbers = replace(address, "\D+", "")
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...