<?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 can I parse 2 sets of CSVs in one file? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287886#M55017</link>
    <description>&lt;P&gt;Are there any line numbers in splunk? Can a splunk search grep for "field[1-3]" and "field[4-7]" and expand a subsearch to "4"?&lt;/P&gt;</description>
    <pubDate>Mon, 26 Oct 2015 16:15:56 GMT</pubDate>
    <dc:creator>hylam</dc:creator>
    <dc:date>2015-10-26T16:15:56Z</dc:date>
    <item>
      <title>How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287881#M55012</link>
      <description>&lt;P&gt;How could I parse this?&lt;/P&gt;

&lt;P&gt;section1String&lt;BR /&gt;
field1,field2,field3&lt;BR /&gt;
value1,value2,value3&lt;BR /&gt;
value1,value2,value3&lt;BR /&gt;
value1,value2,value3&lt;BR /&gt;
section2String&lt;BR /&gt;
field4,field5,field6,field7&lt;BR /&gt;
value4,value5,value6,value7&lt;BR /&gt;
value4,value5,value6,value7&lt;BR /&gt;
value4,value5,value6,value7&lt;/P&gt;

&lt;P&gt;The number of value lines is unknown. Please handle 4 cases&lt;BR /&gt;
a) The header lines are known strings&lt;BR /&gt;
b) The header lines satisfy a regex&lt;BR /&gt;
c) The header lines are 1 line below a known string&lt;BR /&gt;
d) The header lines are 1 line below a string satisfying a regex&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 11:02:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287881#M55012</guid>
      <dc:creator>hylam</dc:creator>
      <dc:date>2015-10-26T11:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287882#M55013</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputcsv TwoInOne.csv | head 4 | outputcsv FirstHalf.csv
| inputcsv TwoInOne.csv | tail 4 | outputcsv SecondHalf.csv

| inputcsv FirstHalf.csv | append [|inputcsv SecondHalf.csv]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2015 15:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287882#M55013</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-26T15:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287883#M55014</link>
      <description>&lt;P&gt;plz see edit1&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 15:35:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287883#M55014</guid>
      <dc:creator>hylam</dc:creator>
      <dc:date>2015-10-26T15:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287884#M55015</link>
      <description>&lt;P&gt;your suggestion should work on fixed number of lines. i have edited the question. thx&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 15:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287884#M55015</guid>
      <dc:creator>hylam</dc:creator>
      <dc:date>2015-10-26T15:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287885#M55016</link>
      <description>&lt;P&gt;The best thing to do is split the file on the outside of splunk.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 16:11:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287885#M55016</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-26T16:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287886#M55017</link>
      <description>&lt;P&gt;Are there any line numbers in splunk? Can a splunk search grep for "field[1-3]" and "field[4-7]" and expand a subsearch to "4"?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 16:15:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287886#M55017</guid>
      <dc:creator>hylam</dc:creator>
      <dc:date>2015-10-26T16:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287887#M55018</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputcsv TwoInOne.csv | rex "(?&amp;lt;filebreaker&amp;gt;SomRegExHere)" | streamstats current=t count(filebreaker) AS fileID | where fileID=0 outputcsv FirstHalf.csv
| inputcsv TwoInOne.csv | rex "(?&amp;lt;filebreaker&amp;gt;SomRegExHere)" | streamstats current=t count(filebreaker) AS fileID | where fileID=1 outputcsv SecondHalf.csv

| inputcsv FirstHalf.csv | append [|inputcsv SecondHalf.csv]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that this approach should work for any number of concatenated files, provided that &lt;CODE&gt;filebreaker&lt;/CODE&gt; is the same.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 16:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287887#M55018</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-26T16:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse 2 sets of CSVs in one file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287888#M55019</link>
      <description>&lt;P&gt;There is an internal field called &lt;CODE&gt;_serial&lt;/CODE&gt; which is a line-number.   I will think more about this approach if my other answer does not work (let me know with followup comments).&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 16:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-2-sets-of-CSVs-in-one-file/m-p/287888#M55019</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-26T16:24:26Z</dc:date>
    </item>
  </channel>
</rss>

