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 (1)
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!

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...

Getting Started with Splunk Artificial Intelligence, Insights for Nonprofits, and ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...