<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Working with CSV files in Bash</title>
	<atom:link href="http://www.thelinuxblog.com/working-with-csv-files-in-bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/</link>
	<description>The Linux Blog, General Linux, Shell Scripts</description>
	<lastBuildDate>Fri, 17 May 2013 01:16:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Bogwitch</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-6686</link>
		<dc:creator>Bogwitch</dc:creator>
		<pubDate>Thu, 01 Mar 2012 23:27:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-6686</guid>
		<description><![CDATA[My own solution:

I extracted each column using variations of &#039;cut&#039; into separate files. I then used &#039;paste&#039; to create a TAB delimited file from the single column files. It was a long way round and although I could have scripted it, I did it manually so as to check each step did not introduce any errors. 
The net result is, I now have a table within my database containing slightly over 75 million records with 100% accuracy!]]></description>
		<content:encoded><![CDATA[<p>My own solution:</p>
<p>I extracted each column using variations of &#8216;cut&#8217; into separate files. I then used &#8216;paste&#8217; to create a TAB delimited file from the single column files. It was a long way round and although I could have scripted it, I did it manually so as to check each step did not introduce any errors.<br />
The net result is, I now have a table within my database containing slightly over 75 million records with 100% accuracy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bogwitch</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-6643</link>
		<dc:creator>Bogwitch</dc:creator>
		<pubDate>Thu, 23 Feb 2012 18:23:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-6643</guid>
		<description><![CDATA[Hi,

I have a peculiar requirement which I hope you can help with. I have a few CSV files that I wish to convert to TSV for importing into MySQL.
Each entry consists of a few text entries that are enclosed within quotation marks, some numeric entries are not. Within the text areas there are occasionally commas!

e.g.

&quot;abcde&quot;,&quot;fghij&quot;,&quot;klm,no&quot;,1234,5678,&quot;&quot;,&quot;pqrst&quot;

There are an equal number of entries on each line.

I have tried a &#039;sed &#039;s/&quot;,&quot;/[tab]/g but the commas are left around the numbers, if I tr &#039;,&#039; &#039;\t&#039; the commas in the enclosed text is converted!

Any help, suggestions, etc gratefully received.

Bog]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have a peculiar requirement which I hope you can help with. I have a few CSV files that I wish to convert to TSV for importing into MySQL.<br />
Each entry consists of a few text entries that are enclosed within quotation marks, some numeric entries are not. Within the text areas there are occasionally commas!</p>
<p>e.g.</p>
<p>&#8220;abcde&#8221;,&#8221;fghij&#8221;,&#8221;klm,no&#8221;,1234,5678,&#8221;",&#8221;pqrst&#8221;</p>
<p>There are an equal number of entries on each line.</p>
<p>I have tried a &#8216;sed &#8216;s/&#8221;,&#8221;/[tab]/g but the commas are left around the numbers, if I tr &#8216;,&#8217; &#8216;\t&#8217; the commas in the enclosed text is converted!</p>
<p>Any help, suggestions, etc gratefully received.</p>
<p>Bog</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-6421</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Tue, 20 Dec 2011 19:22:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-6421</guid>
		<description><![CDATA[Hey @Patrick, make sure there is only one character for the cut -f field. The space is done by using:
-f \&lt;space&gt;&lt;space&gt;
Also make sure -f is only defined once. 
Another issue is that sometimes quotes and apostrophes get translated incorrectly, try replacing any of those for the standard issue ones. 

Hope this helps!]]></description>
		<content:encoded><![CDATA[<p>Hey @Patrick, make sure there is only one character for the cut -f field. The space is done by using:<br />
-f \<space></space><space><br />
Also make sure -f is only defined once.<br />
Another issue is that sometimes quotes and apostrophes get translated incorrectly, try replacing any of those for the standard issue ones. </p>
<p>Hope this helps!</space></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-6420</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Tue, 20 Dec 2011 18:12:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-6420</guid>
		<description><![CDATA[Hi, i&#039;m afraid your scripts are not working for me. Especially the one fo count the number of elements in the csv file. The error it comes up with is:



&quot;cut: the delimiter must be a single character
 Try &#039;cut --help&#039; for more information.&quot;]]></description>
		<content:encoded><![CDATA[<p>Hi, i&#8217;m afraid your scripts are not working for me. Especially the one fo count the number of elements in the csv file. The error it comes up with is:</p>
<p>&#8220;cut: the delimiter must be a single character<br />
 Try &#8216;cut &#8211;help&#8217; for more information.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikolay</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-3182</link>
		<dc:creator>Nikolay</dc:creator>
		<pubDate>Tue, 08 Jun 2010 07:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-3182</guid>
		<description><![CDATA[Hallo, 
Thanks for the post - it is vetry useful indeed.
However i am strugling with the following - I have
to convert a csv file into ANSII file..
Could you please help me with that - I&#039;d like to point out that I am really inexperienced bash/awk script user, but eager to learn :)]]></description>
		<content:encoded><![CDATA[<p>Hallo,<br />
Thanks for the post &#8211; it is vetry useful indeed.<br />
However i am strugling with the following &#8211; I have<br />
to convert a csv file into ANSII file..<br />
Could you please help me with that &#8211; I&#8217;d like to point out that I am really inexperienced bash/awk script user, but eager to learn :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-1878</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Thu, 12 Feb 2009 14:35:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-1878</guid>
		<description><![CDATA[@SWATKAT I guess I don&#039;t understand what it is you are exactly trying to do. Split will split the file into the 65,000 lines. Are you trying to add the 65,000 line to the 2nd file if the second field on the 65,000 line is the same as the 2nd field on the 2nd file? I am assuming you would want this at the beginning of the file correct?

Let me know and I&#039;ll try and help.]]></description>
		<content:encoded><![CDATA[<p>@SWATKAT I guess I don&#8217;t understand what it is you are exactly trying to do. Split will split the file into the 65,000 lines. Are you trying to add the 65,000 line to the 2nd file if the second field on the 65,000 line is the same as the 2nd field on the 2nd file? I am assuming you would want this at the beginning of the file correct?</p>
<p>Let me know and I&#8217;ll try and help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: swatkat</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-1877</link>
		<dc:creator>swatkat</dc:creator>
		<pubDate>Thu, 12 Feb 2009 13:42:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-1877</guid>
		<description><![CDATA[Hi, i would like to know how to split a large CSV file in chunks of 65000 lines.

split works fine here, but the condition is it should check for the 2nd column.. if the 2nd column has the same value as that of the 65000 - 1th line (2nd column), then this line too should be appended to the 2nd file created.

thx.]]></description>
		<content:encoded><![CDATA[<p>Hi, i would like to know how to split a large CSV file in chunks of 65000 lines.</p>
<p>split works fine here, but the condition is it should check for the 2nd column.. if the 2nd column has the same value as that of the 65000 &#8211; 1th line (2nd column), then this line too should be appended to the 2nd file created.</p>
<p>thx.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-1512</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Mon, 24 Nov 2008 18:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-1512</guid>
		<description><![CDATA[Hey Jack,

If those records are automatically put out into a file and follow the same format regardless of if the data exists it shouldn&#039;t be too hard.

If there are two line breaks in between each record then you could process the file that way. As there are semicolons and quotes in the file you will have to escape the query.

If you are trying to import 5000 records into mysql you may be better off using a php or perl script to read the file, but it can be done with bash if you HAVE to use it.]]></description>
		<content:encoded><![CDATA[<p>Hey Jack,</p>
<p>If those records are automatically put out into a file and follow the same format regardless of if the data exists it shouldn&#8217;t be too hard.</p>
<p>If there are two line breaks in between each record then you could process the file that way. As there are semicolons and quotes in the file you will have to escape the query.</p>
<p>If you are trying to import 5000 records into mysql you may be better off using a php or perl script to read the file, but it can be done with bash if you HAVE to use it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jack</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-1498</link>
		<dc:creator>jack</dc:creator>
		<pubDate>Sat, 22 Nov 2008 04:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-1498</guid>
		<description><![CDATA[hi linuxblog, really good intro tutorial for sed on csv, any I&#039;m stuck with some problem on converting text file to csv file, apprieacite if you could help me, i have a file like below (3 records) but with more than 5k records:

Fri Aug 01 00:01:19 2008
        NAS-IP-Address = 172.16.160.1
        Class = &quot;P1-SHT-AAA01;1217116976;70999&quot;
        Calling-Station-Id = &quot;00-1F-FB-00-02-26&quot;
        Acct-Status-Type = Stop
        Acct-Session-Id = &quot;31908b485a370000&quot;
        Framed-IP-Address = 172.16.160.2
        WiMAX-BS-ID = 000012A00433
        User-Name = &quot;joe&quot;

Fri Aug 01 00:02:02 2008
        NAS-IP-Address = 172.16.160.1
        Class = &quot;P1-SHT-AAA01;1217116976;71005&quot;
        Calling-Station-Id = &quot;00-1F-FB-00-06-61&quot;
        Acct-Status-Type = Start
        Acct-Session-Id = &quot;31908b485d370000&quot;
        Framed-IP-Address = 172.16.160.2
        WiMAX-BS-ID = 000012A00413
        User-Name = &quot;john&quot;

Fri Aug 01 00:02:02 2008
        NAS-IP-Address = 172.16.160.1
        Class = &quot;P1-SHT-AAA01;1217116976;71005&quot;
        Calling-Station-Id = &quot;00-1F-FB-00-06-61&quot;
        Acct-Status-Type = Update
        Acct-Session-Id = &quot;31908b485d370000&quot;
        Framed-IP-Address = 172.16.160.2
        WiMAX-BS-ID = 000012A00413
        User-Name = &quot;don&quot;

and I need to make csv file to import to sql db like below:

2008-08-1;172.16.160.1;P1-SHT-AAA01;1217116976;71005;00-1F-FB-00-06-61;Start;31908b485d370000;172.16.160.2;000012A00413;joe

possible to do it in sed ? iam really appreaciete your help, thanks.]]></description>
		<content:encoded><![CDATA[<p>hi linuxblog, really good intro tutorial for sed on csv, any I&#8217;m stuck with some problem on converting text file to csv file, apprieacite if you could help me, i have a file like below (3 records) but with more than 5k records:</p>
<p>Fri Aug 01 00:01:19 2008<br />
        NAS-IP-Address = 172.16.160.1<br />
        Class = &#8220;P1-SHT-AAA01;1217116976;70999&#8243;<br />
        Calling-Station-Id = &#8220;00-1F-FB-00-02-26&#8243;<br />
        Acct-Status-Type = Stop<br />
        Acct-Session-Id = &#8220;31908b485a370000&#8243;<br />
        Framed-IP-Address = 172.16.160.2<br />
        WiMAX-BS-ID = 000012A00433<br />
        User-Name = &#8220;joe&#8221;</p>
<p>Fri Aug 01 00:02:02 2008<br />
        NAS-IP-Address = 172.16.160.1<br />
        Class = &#8220;P1-SHT-AAA01;1217116976;71005&#8243;<br />
        Calling-Station-Id = &#8220;00-1F-FB-00-06-61&#8243;<br />
        Acct-Status-Type = Start<br />
        Acct-Session-Id = &#8220;31908b485d370000&#8243;<br />
        Framed-IP-Address = 172.16.160.2<br />
        WiMAX-BS-ID = 000012A00413<br />
        User-Name = &#8220;john&#8221;</p>
<p>Fri Aug 01 00:02:02 2008<br />
        NAS-IP-Address = 172.16.160.1<br />
        Class = &#8220;P1-SHT-AAA01;1217116976;71005&#8243;<br />
        Calling-Station-Id = &#8220;00-1F-FB-00-06-61&#8243;<br />
        Acct-Status-Type = Update<br />
        Acct-Session-Id = &#8220;31908b485d370000&#8243;<br />
        Framed-IP-Address = 172.16.160.2<br />
        WiMAX-BS-ID = 000012A00413<br />
        User-Name = &#8220;don&#8221;</p>
<p>and I need to make csv file to import to sql db like below:</p>
<p>2008-08-1;172.16.160.1;P1-SHT-AAA01;1217116976;71005;00-1F-FB-00-06-61;Start;31908b485d370000;172.16.160.2;000012A00413;joe</p>
<p>possible to do it in sed ? iam really appreaciete your help, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/working-with-csv-files-in-bash/comment-page-1/#comment-1392</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Mon, 10 Nov 2008 15:12:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/working-with-csv-files-in-bash/#comment-1392</guid>
		<description><![CDATA[I appreciate your input @TOM. If there are any topics you or any one else would like me to write on, just let me know!]]></description>
		<content:encoded><![CDATA[<p>I appreciate your input @TOM. If there are any topics you or any one else would like me to write on, just let me know!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
