<?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 Split pattern into multiple rows? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650454#M224870</link>
    <description>&lt;P&gt;Split pattern in CSV lookup format into multiple rows&lt;BR /&gt;| lookup table.csv&lt;BR /&gt;Note that the number of SubnetID-IP pair is not always 4.&amp;nbsp; &amp;nbsp;It could be from 1 to 4&amp;nbsp; or more (1...&amp;nbsp; N)&lt;BR /&gt;The example below is only one row, but the real data has multiple rows (eg. Comp-B to Comp-Z)&lt;BR /&gt;&lt;BR /&gt;Before the split:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SubnetID-IP&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Loc- A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[{"subnet_id":"101","ip_address":"192.168.1.1"},{"subnet_id":"102","ip_address":"192.168.1.2"},{"subnet_id":"103","ip_address":"192.168.1.3"},{"subnet_id":"104","ip_address":"fd12:3456:789a:1::1"}]&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After the split:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subnetID&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 192.168.1.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;101&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 192.168.1.2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;102&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 192.168.1.3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;103&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fd12:3456:789a:1::1 &amp;nbsp; &amp;nbsp; 104&lt;BR /&gt;&lt;BR /&gt;Thank you so much for your help&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jul 2023 19:04:11 GMT</pubDate>
    <dc:creator>LearningGuy</dc:creator>
    <dc:date>2023-07-14T19:04:11Z</dc:date>
    <item>
      <title>Split pattern into multiple rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650454#M224870</link>
      <description>&lt;P&gt;Split pattern in CSV lookup format into multiple rows&lt;BR /&gt;| lookup table.csv&lt;BR /&gt;Note that the number of SubnetID-IP pair is not always 4.&amp;nbsp; &amp;nbsp;It could be from 1 to 4&amp;nbsp; or more (1...&amp;nbsp; N)&lt;BR /&gt;The example below is only one row, but the real data has multiple rows (eg. Comp-B to Comp-Z)&lt;BR /&gt;&lt;BR /&gt;Before the split:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SubnetID-IP&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Loc- A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[{"subnet_id":"101","ip_address":"192.168.1.1"},{"subnet_id":"102","ip_address":"192.168.1.2"},{"subnet_id":"103","ip_address":"192.168.1.3"},{"subnet_id":"104","ip_address":"fd12:3456:789a:1::1"}]&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After the split:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subnetID&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 192.168.1.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;101&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 192.168.1.2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;102&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 192.168.1.3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;103&lt;BR /&gt;Comp-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Loc-A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fd12:3456:789a:1::1 &amp;nbsp; &amp;nbsp; 104&lt;BR /&gt;&lt;BR /&gt;Thank you so much for your help&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 19:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650454#M224870</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-14T19:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Split pattern into multiple rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650469#M224875</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;&amp;nbsp;is your fiend.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath input=Subnet-IP path={}
| mvexpand {}
| spath input={}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your sample data gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="70.03125px" height="25px"&gt;Company&lt;/TD&gt;&lt;TD width="53.546875px" height="25px"&gt;Location&lt;/TD&gt;&lt;TD width="155.421875px" height="25px"&gt;ip_address&lt;/TD&gt;&lt;TD width="83.4375px" height="25px"&gt;subnet_id&lt;/TD&gt;&lt;TD width="403.53125px" height="25px"&gt;{}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="70.03125px" height="25px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="53.546875px" height="25px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="155.421875px" height="25px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="83.4375px" height="25px"&gt;101&lt;/TD&gt;&lt;TD width="403.53125px" height="25px"&gt;{"subnet_id":"101","ip_address":"192.168.1.1"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="70.03125px" height="25px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="53.546875px" height="25px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="155.421875px" height="25px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="83.4375px" height="25px"&gt;102&lt;/TD&gt;&lt;TD width="403.53125px" height="25px"&gt;{"subnet_id":"102","ip_address":"192.168.1.2"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="70.03125px" height="25px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="53.546875px" height="25px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="155.421875px" height="25px"&gt;192.168.1.3&lt;/TD&gt;&lt;TD width="83.4375px" height="25px"&gt;103&lt;/TD&gt;&lt;TD width="403.53125px" height="25px"&gt;{"subnet_id":"103","ip_address":"192.168.1.3"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="70.03125px" height="25px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="53.546875px" height="25px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="155.421875px" height="25px"&gt;fd12:3456:789a:1::1&lt;/TD&gt;&lt;TD width="83.4375px" height="25px"&gt;104&lt;/TD&gt;&lt;TD width="403.53125px" height="25px"&gt;{"subnet_id":"104","ip_address":"fd12:3456:789a:1::1"}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This is an emulation that you can play with and compare to your real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval Company = "Comp-A", Location = "Loc-A", Subnet-IP = "[{\"subnet_id\":\"101\",\"ip_address\":\"192.168.1.1\"},{\"subnet_id\":\"102\",\"ip_address\":\"192.168.1.2\"},{\"subnet_id\":\"103\",\"ip_address\":\"192.168.1.3\"},{\"subnet_id\":\"104\",\"ip_address\":\"fd12:3456:789a:1::1\"}]"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 23:48:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650469#M224875</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-13T23:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Split pattern into multiple rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650614#M224933</link>
      <description>&lt;P&gt;Your first suggestion worked. Thank you so much&lt;/P&gt;&lt;PRE&gt;| spath input=Subnet-IP path={}
| mvexpand {}
| spath input={}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I ran your second suggestion and received this "&lt;SPAN&gt;&lt;EM&gt;Error in 'makeresults' command: This command must be the first command of a search.&lt;/EM&gt;"&lt;/SPAN&gt;&lt;BR /&gt;What is the purpose of the following commands?&lt;BR /&gt;Note that my search is using | inputlookup test.csv. It looks like makeresults didn't work with inputlookup. Thank you&lt;/P&gt;&lt;PRE&gt;| makeresults
| eval Company = "Comp-A", Location = "Loc-A", Subnet-IP = "[{\"subnet_id\":\"101\",\"ip_address\":\"192.168.1.1\"},{\"subnet_id\":\"102\",\"ip_address\":\"192.168.1.2\"},{\"subnet_id\":\"103\",\"ip_address\":\"192.168.1.3\"},{\"subnet_id\":\"104\",\"ip_address\":\"fd12:3456:789a:1::1\"}]"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 18:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650614#M224933</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-14T18:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Split pattern into multiple rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650660#M224962</link>
      <description>&lt;P&gt;The makeresults block is meant to emulate inputlookup as a way of comparison in case the solution gives unexpected output.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jul 2023 05:32:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650660#M224962</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-15T05:32:43Z</dc:date>
    </item>
  </channel>
</rss>

