Splunk Search

Consecutive characters dash in a file for extraction

royimad
Builder

I have a file that contains consecutive -

example: somefields - anything - anything - ... - anything ABC DEF 23232 - anything

How do i extract the content of the delimited field between the 7 - "dash" and the 8 - "dash"?
PS: I don't want to use transform.conf with DELIM="-", i need to use regular expression for this field only the one between the dash number 7 and the dash number 8.

Tags (4)
0 Karma

Ayn
Legend
(?:[^-]*\-){7}(?<yourfield>[^-]*)

should do it. Verify at regexpal.com or similar (remove ?<yourfield> when you do this).

Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...