All Apps and Add-ons

How do I split a column by comma and convert the result into multiple rows?

Liuzhengchen
Explorer

Hi guys,

How do I split column by comma and convert the result into multiple rows?

eg.
host ips
A 1.1.1.1,1.1.1.2
B 2.2.2.2,2.2.2.3

need to convert to

host ips
A 1.1.1.1
A 1.1.1.2
B 2.2.2.2
B 2.2.2.3

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@Liuzhengchen,

Try,

"your current search to get host,ips" |makemv ips delim=","|mvexpand ips

References :
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Makemv
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvexpand

---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

renjith_nair
Legend

@Liuzhengchen,

Try,

"your current search to get host,ips" |makemv ips delim=","|mvexpand ips

References :
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Makemv
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvexpand

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

Liuzhengchen
Explorer

It works for me. Thank you so much renjith.

0 Karma
Get Updates on the Splunk Community!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...