Splunk Search

How do I remove all 1 and 2 character words from a field?

andrewtrobec
Motivator

Hello,
I have a string field containing many words and I would like to remove all 1 and 2 character words from it. How do I do that? If my first sentence was the field value, the resulting output would be:

have string field containing many words and would like remove all and character words from

Best regards,

Andrew

Tags (1)
0 Karma
1 Solution

FrankVl
Ultra Champion

Add the following to your existing search:

| rex field=yourfield mode=sed "s/\b(\w{1,2})\b//g"

https://regex101.com/r/EPipoO/1

View solution in original post

FrankVl
Ultra Champion

Add the following to your existing search:

| rex field=yourfield mode=sed "s/\b(\w{1,2})\b//g"

https://regex101.com/r/EPipoO/1

andrewtrobec
Motivator

That's the one! Thank you!

0 Karma
Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco + Splunk! We’ve ...