Getting Data In

Can you rename strings within mv-fields

lmacneil76
Explorer

Id like to rename every instance of "dragDrop" to "stackDragDrop" from a multi-value field.

The search below just renames one instance. Any ideas on how to do this?

source="C:\\var\\regression_items\\*.xml" 
| rex "title=\"(?P<id>\d+)\"" 
| rex max_match=0 "(class=\"stack\").+(data-type=\")(?P<STACK>\w+)(\")"
| eval TEST=mvfilter(STACK = "dragDrop")
| eval selectionElements=case(TEST="dragDrop", "stackDragDrop") 
| table id selectionElements TEST
Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try this

source="C:\\var\\regression_items\\*.xml" 
| rex "title=\"(?P<id>\d+)\"" 
| rex max_match=0 "(class=\"stack\").+(data-type=\")(?P<STACK>\w+)(\")"
| eval TEST=mvfilter(STACK="dragDrop") |eval selectionElements=TEST | replace dragDrop with stackDragDrop in selectionElements
| table id selectionElements TEST

View solution in original post

somesoni2
Revered Legend

Try this

source="C:\\var\\regression_items\\*.xml" 
| rex "title=\"(?P<id>\d+)\"" 
| rex max_match=0 "(class=\"stack\").+(data-type=\")(?P<STACK>\w+)(\")"
| eval TEST=mvfilter(STACK="dragDrop") |eval selectionElements=TEST | replace dragDrop with stackDragDrop in selectionElements
| table id selectionElements TEST

lmacneil76
Explorer

Perfect! I was missing replace. Thanks!

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, ...