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

Happy Splunking!

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

Happy Splunking!
0 Karma

Liuzhengchen
Explorer

It works for me. Thank you so much renjith.

0 Karma
Get Updates on the Splunk Community!

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

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...