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+"
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...