Export to CSV - proper format

Bill Campbell bill at celestial.com
Wed Oct 20 14:34:22 PDT 2010


On Wed, Oct 20, 2010, flavius m wrote:
>
>Hello,
>
>What is the best (most efficient) way to export data from FilePro to a proper CSV file?
>
>I use the following:
>export word aaa=/tmp/exported_file.txt f=, r=\n
>
>... but my problem is that the inner quotes are not escaped (per CSV format, the quotes inside a csv record should be duplicated: e.g. "this ""is"" my test").

I generally prefer to use tab-delimited files to comma-delimited
as this eliminated problems like this.

A simple way to change comma-delimited files with "," separating
records with a modern version of sed would be:

	sed -e 's/","/\t/g' < /tmp/exported_file.txt > /tmp/exported_file.tsv

Similar things can be done with a perl one-liner, python, etc.

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

A petty thief is put in jail. A great brigand becomes ruler of a
State. -- Chuang Tzu


More information about the Filepro-list mailing list