<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How expand two related mutli value fields ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314821#M94228</link>
    <description>&lt;P&gt;You can try mvzip command to stitch these multivalued fields together and then expand.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | rename field#1 as field1,field#2 as field2,field#3 as field3 | makemv field2 delim="," | makemv field3 delim="," | eval field4=mvzip(field2,field3) | mvexpand field4 | rex field=field4 "(?&amp;lt;field2&amp;gt;[^\,]+)\,(?&amp;lt;field3&amp;gt;[^\,]+)" | table field1 field2 field3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 May 2017 11:45:02 GMT</pubDate>
    <dc:creator>dineshraj9</dc:creator>
    <dc:date>2017-05-23T11:45:02Z</dc:date>
    <item>
      <title>How expand two related mutli value fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314820#M94227</link>
      <description>&lt;P&gt;Hi, I'm trying to analyze some data that contains two related multi value fields that i want to expand.&lt;/P&gt;

&lt;P&gt;What i have looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;field #1         field#2            field #3
green            1,2,4              one,two,four
blue             7,6                seven,six
red              9                  nine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I want to have&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;green    1       one
green    2       two
green    4       four
blue     7       seven
blue     6       six
red      9       nine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is easy to expand one mutlivalue field using mvexpand, but if i try to expand both fields i get duplicate rows.&lt;/P&gt;

&lt;P&gt;Any idea how i can expand both fields at the same time ?&lt;/P&gt;

&lt;P&gt;Cheers&lt;BR /&gt;
Frank&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 09:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314820#M94227</guid>
      <dc:creator>fbotte</dc:creator>
      <dc:date>2017-05-23T09:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: How expand two related mutli value fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314821#M94228</link>
      <description>&lt;P&gt;You can try mvzip command to stitch these multivalued fields together and then expand.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | rename field#1 as field1,field#2 as field2,field#3 as field3 | makemv field2 delim="," | makemv field3 delim="," | eval field4=mvzip(field2,field3) | mvexpand field4 | rex field=field4 "(?&amp;lt;field2&amp;gt;[^\,]+)\,(?&amp;lt;field3&amp;gt;[^\,]+)" | table field1 field2 field3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 May 2017 11:45:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314821#M94228</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-05-23T11:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: How expand two related mutli value fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314822#M94229</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="green 1,2,4 one,two,four::blue 7,6 seven,six::red 9 nine" 
| makemv delim="::" raw 
| mvexpand raw
| rename raw AS _raw
| rex "^(?&amp;lt;F1&amp;gt;\S+)\s+(?&amp;lt;F2&amp;gt;\S+)\s+(?&amp;lt;F3&amp;gt;.*)$"
| fields - _*

| rename COMMENT AS "Evertying above fakes test data; everything below is your solution"

| makemv delim="," F2
| makemv delim="," F3
| eval F2andF3=mvzip(F2,F3)
| mvexpand F2andF3
| rex field=F2andF3 "^(?&amp;lt;F2&amp;gt;[^,]+),(?&amp;lt;F3&amp;gt;.*)$"
| fields - F2andF3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 May 2017 23:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-expand-two-related-mutli-value-fields/m-p/314822#M94229</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-23T23:16:29Z</dc:date>
    </item>
  </channel>
</rss>

