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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...