Splunk Search

What is the Splunk regular expression to remove characters/number after second space?

DataOrg
Builder

i want the data to be deleted after a second space.

EX:data is like this "lenovo thinkcentre 6.7" and i want "lenovo thinkcentre"

lenovo thinkcentre 6.7 --- lenovo thinkcentre
DELL workspace (FULL server) --- DELL workspace
samsung S8 full version. ----- samsung S8
0 Karma
1 Solution

kmorris_splunk
Splunk Employee
Splunk Employee

If this data is already extracted into a field try:

... | rex field=yourfield "^(?<myval>\w+\s+\w+)\s+"

View solution in original post

mstjohn_splunk
Splunk Employee
Splunk Employee

hi @premranjithj

Did the answer below solve your problem? If so, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!

0 Karma

kmorris_splunk
Splunk Employee
Splunk Employee

If this data is already extracted into a field try:

... | rex field=yourfield "^(?<myval>\w+\s+\w+)\s+"
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...