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!

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

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

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

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