<?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 to split one Line into multiple lines while search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203967#M187670</link>
    <description>&lt;P&gt;See if this get you going&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xmlkv | spath output=s path=Document.FacilitySite | table s | eval y=mvindex(s, 2) | mvexpand s | table s, y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the above query, s has all instances of the node, &lt;CODE&gt;mvexpand&lt;/CODE&gt; breaks them out into separate rows. &lt;CODE&gt;mvindex(s, 2)&lt;/CODE&gt; gets the 3rd instance.&lt;/P&gt;

&lt;P&gt;For more info...&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/spath"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/spath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/Search/Parsemultivaluefields"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/Search/Parsemultivaluefields&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Dec 2015 20:07:05 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2015-12-31T20:07:05Z</dc:date>
    <item>
      <title>How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203966#M187669</link>
      <description>&lt;P&gt;In reference to my other post &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/337397/how-to-break-xml-in-search-time.html"&gt;https://answers.splunk.com/answers/337397/how-to-break-xml-in-search-time.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I am adding other way of the question. &lt;/P&gt;

&lt;P&gt;I have total xml data in a field like below. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;Document xsi:noNamespaceSchemaLocation="EPA_GEODATA_v1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;   
    &amp;lt;FacilitySite registryId="110007915364"&amp;gt;
        &amp;lt;FacilitySiteName&amp;gt;GREAT SOUTHERN WOOD PRESERVING INC&amp;lt;/FacilitySiteName&amp;gt;
        &amp;lt;LocationAddressText&amp;gt;1100 HIGHWAY 431 NORTH&amp;lt;/LocationAddressText&amp;gt;
        &amp;lt;LocalityName&amp;gt;ABBEVILLE&amp;lt;/LocalityName&amp;gt;
        &amp;lt;LocationAddressStateCode&amp;gt;AL&amp;lt;/LocationAddressStateCode&amp;gt;
    &amp;lt;/FacilitySite&amp;gt;
    &amp;lt;FacilitySite registryId="110000369084"&amp;gt;
        &amp;lt;FacilitySiteName&amp;gt;REMBRANDT FOODS- ABBEVILLE&amp;lt;/FacilitySiteName&amp;gt;
        &amp;lt;LocationAddressText&amp;gt;496 INDUSTRIAL PARK RD&amp;lt;/LocationAddressText&amp;gt;
        &amp;lt;LocalityName&amp;gt;ABBEVILLE&amp;lt;/LocalityName&amp;gt;
        &amp;lt;LocationAddressStateCode&amp;gt;AL&amp;lt;/LocationAddressStateCode&amp;gt;
        &amp;lt;LocationZIPCode&amp;gt;36310&amp;lt;/LocationZIPCode&amp;gt;
    &amp;lt;/FacilitySite&amp;gt;
    &amp;lt;FacilitySite registryId="110055437718"&amp;gt;
        &amp;lt;FacilitySiteName&amp;gt;RITE AID #7092&amp;lt;/FacilitySiteName&amp;gt;
        &amp;lt;LocationAddressText&amp;gt;514 KIRKLAND STREET&amp;lt;/LocationAddressText&amp;gt;
        &amp;lt;LocalityName&amp;gt;ABBEVILLE&amp;lt;/LocalityName&amp;gt;
        &amp;lt;LocationAddressStateCode&amp;gt;AL&amp;lt;/LocationAddressStateCode&amp;gt;
        &amp;lt;LocationZIPCode&amp;gt;36310-2700&amp;lt;/LocationZIPCode&amp;gt;
        &amp;lt;LatitudeMeasure&amp;gt;31.56149&amp;lt;/LatitudeMeasure&amp;gt;
    &amp;lt;/FacilitySite&amp;gt;
&amp;lt;/Document&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to break the entire field into multiple rows. like below. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;----------------------------------------------------------------------------------------
          &amp;lt;FacilitySite registryId="110007915364"&amp;gt;
                &amp;lt;FacilitySiteName&amp;gt;GREAT SOUTHERN WOOD PRESERVING INC&amp;lt;/FacilitySiteName&amp;gt;
                &amp;lt;LocationAddressText&amp;gt;1100 HIGHWAY 431 NORTH&amp;lt;/LocationAddressText&amp;gt;
                &amp;lt;LocalityName&amp;gt;ABBEVILLE&amp;lt;/LocalityName&amp;gt;
                &amp;lt;LocationAddressStateCode&amp;gt;AL&amp;lt;/LocationAddressStateCode&amp;gt;
            &amp;lt;/FacilitySite&amp;gt;
----------------------------------------------------------------------------------------
    &amp;lt;FacilitySite registryId="110000369084"&amp;gt;
            &amp;lt;FacilitySiteName&amp;gt;REMBRANDT FOODS- ABBEVILLE&amp;lt;/FacilitySiteName&amp;gt;
            &amp;lt;LocationAddressText&amp;gt;496 INDUSTRIAL PARK RD&amp;lt;/LocationAddressText&amp;gt;
            &amp;lt;LocalityName&amp;gt;ABBEVILLE&amp;lt;/LocalityName&amp;gt;
            &amp;lt;LocationAddressStateCode&amp;gt;AL&amp;lt;/LocationAddressStateCode&amp;gt;
            &amp;lt;LocationZIPCode&amp;gt;36310&amp;lt;/LocationZIPCode&amp;gt;
        &amp;lt;/FacilitySite&amp;gt;
----------------------------------------------------------------------------------------
&amp;lt;FacilitySite registryId="110055437718"&amp;gt;
            &amp;lt;FacilitySiteName&amp;gt;RITE AID #7092&amp;lt;/FacilitySiteName&amp;gt;
            &amp;lt;LocationAddressText&amp;gt;514 KIRKLAND STREET&amp;lt;/LocationAddressText&amp;gt;
            &amp;lt;LocalityName&amp;gt;ABBEVILLE&amp;lt;/LocalityName&amp;gt;
            &amp;lt;LocationAddressStateCode&amp;gt;AL&amp;lt;/LocationAddressStateCode&amp;gt;
            &amp;lt;LocationZIPCode&amp;gt;36310-2700&amp;lt;/LocationZIPCode&amp;gt;
            &amp;lt;LatitudeMeasure&amp;gt;31.56149&amp;lt;/LatitudeMeasure&amp;gt;
        &amp;lt;/FacilitySite&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know how could i do it. I tried rex, but i do not think that can give multiple rows out of one. &lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 15:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203966#M187669</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2015-12-31T15:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203967#M187670</link>
      <description>&lt;P&gt;See if this get you going&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xmlkv | spath output=s path=Document.FacilitySite | table s | eval y=mvindex(s, 2) | mvexpand s | table s, y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the above query, s has all instances of the node, &lt;CODE&gt;mvexpand&lt;/CODE&gt; breaks them out into separate rows. &lt;CODE&gt;mvindex(s, 2)&lt;/CODE&gt; gets the 3rd instance.&lt;/P&gt;

&lt;P&gt;For more info...&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/spath"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/spath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/Search/Parsemultivaluefields"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/Search/Parsemultivaluefields&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 20:07:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203967#M187670</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-31T20:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203968#M187671</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;but, the attribute registry id is not coming. Is it coming for your search.? How could you get that.?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 00:29:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203968#M187671</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-01-01T00:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203969#M187672</link>
      <description>&lt;P&gt;&lt;CODE&gt;| spath output=r path=Document.FacilitySite{@registryId}&lt;/CODE&gt; will give you registryId.`&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 14:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203969#M187672</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-01T14:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203970#M187673</link>
      <description>&lt;P&gt;NO, sundaresh, I meant, i want both node and the registry id. How can i get two outputs from spath at the same time. &amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 15:09:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203970#M187673</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-01-01T15:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203971#M187674</link>
      <description>&lt;P&gt;&lt;CODE&gt;| spath output=s path=Document.FacilitySite | spath output=r path=Document.FacilitySite{@registryId}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Maybe if you explain what you are trying to accomplish, end goal, I can try and give you a better answer.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 15:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203971#M187674</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-01T15:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203972#M187675</link>
      <description>&lt;P&gt;Hi Sundaresh, &lt;/P&gt;

&lt;P&gt;I would really thank you for your patience and help. The below is the format like which i am expecting output with registry id and node.&lt;/P&gt;

&lt;P&gt;I could not paste it properly in the comment, so i have added it in question it self. Please see the latest edit in question.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 20:19:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203972#M187675</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-01-01T20:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203973#M187676</link>
      <description>&lt;P&gt;For each node, i need nodedata and registry id. I tried using two xpaths,  but they are coming out as two different groups. &lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2016 20:34:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203973#M187676</guid>
      <dc:creator>sdaruna</dc:creator>
      <dc:date>2016-01-01T20:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to split one Line into multiple lines while search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203974#M187677</link>
      <description>&lt;P&gt;Now I get it. Try this... Basically, I pull all the nodes into variable, then combine the variables so they a single row for all nodedata. Then split them using the separator and finally, get the appropriate values from the array. Let me know if the below query doesn't work for you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath | rename Document.FacilitySite{@registryId} as r | rename Document.FacilitySite.FacilitySiteName as s | rename Document.FacilitySite.LocationAddressText as a | rename Document.FacilitySite.LocalityName as l | rename Document.FacilitySite.LocationAddressStateCode as c |  eval z=mvzip(r, s, "@@") | eval z=mvzip(z, a, "@@") | eval z=mvzip(z, l, "@@") | eval z=mvzip(z, c, "@@") | mvexpand z | eval site=split(z, "@@") | eval regid=mvindex(site, 0) | eval sitename=mvindex(site, 1) | eval add=mvindex(site, 2) | eval local=mvindex(site, 3) | eval state=mvindex(site, 4) | eval zip=mvindex(site, 5) | table regid, sitename, add, local, state
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Jan 2016 23:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-one-Line-into-multiple-lines-while-search/m-p/203974#M187677</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-01T23:30:10Z</dc:date>
    </item>
  </channel>
</rss>

