Splunk Search

help to make regex

ckals46
New Member

hello all!

I have a sentense of raw data so I want to extract only one field.

raw data's example :

A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N

after example :

A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N

I want to change 12th field into a '*'

Please help me. Give me make it 😐

0 Karma

somesoni2
Revered Legend

You can try like this

| gentimes start=-1 | eval temp="A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N" | table temp | rename temp as _raw | rex mode=sed "s/^(([^,]*,){11})([^,]*)/\1*/"
0 Karma
Get Updates on the Splunk Community!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...