Splunk Search

How to Split rows into columns

vik
Explorer

I am trying to split the values in both the columns and create 5 rows by assigning respective values. I need an output as below. Can someone suggest how can I achieve this ? 

I tried mvexpand but it does not seem to help. Anything else we can try ? 

 

field1       | field 2 

-------------------------------

Name 1   |  10

-------------------------------

Name 2   | 12

 

Screen Shot 2023-03-09 at 5.14.59 PM.png

Labels (2)
0 Karma
1 Solution

Tom_Lundie
Contributor

How about something like this?

| eval tmp_field = mvzip(field1, field2, "-|-")
| fields - field1, field2
| mvexpand tmp_field
| makemv delim="-|-" tmp_field
| eval field1 = mvindex(tmp_field, 0)
| eval field2 = mvindex(tmp_field, 1)
| fields - tmp_field

 

View solution in original post

0 Karma

Tom_Lundie
Contributor

How about something like this?

| eval tmp_field = mvzip(field1, field2, "-|-")
| fields - field1, field2
| mvexpand tmp_field
| makemv delim="-|-" tmp_field
| eval field1 = mvindex(tmp_field, 0)
| eval field2 = mvindex(tmp_field, 1)
| fields - tmp_field

 

0 Karma

vik
Explorer

Thanks a lot! 

Tags (1)
0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

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