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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...