Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2009 13:10:47 -0500
From:      John Almberg <jalmberg@identry.com>
To:        Roland Smith <rsmith@xs4all.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: tab-delimited to csv
Message-ID:  <30696042-D9B5-4239-A560-00D20DBE5177@identry.com>
In-Reply-To: <20090216175556.GA53460@slackbox.xs4all.nl>
References:  <A1268853-0066-4604-AB9E-7D45E738BF32@identry.com> <20090216175556.GA53460@slackbox.xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

On Feb 16, 2009, at 12:55 PM, Roland Smith wrote:

> On Mon, Feb 16, 2009 at 11:55:50AM -0500, John Almberg wrote:
>> Can anyone suggest a way to convert a tab-delimited file to csv using
>> standard unix utilities? I could whip up a Ruby script to do it, but
>
> As long as the files don't contain commas themselves,

Right, that's the tricky bit. I could use tr otherwise.

>
>> I hate to reinvent the wheel.
>
> I'd whip up that script. There is a shareware tab2csv utility for
> windows for $49.95: http://www.download32.com/info-pack-com-tab2csv- 
> i31827.html

I'm working on it, right now.

I also saw that windows utility, but doesn't help me much.

>
> OTOH, if you have a spreadsheet program like Gnumeric or OpenOffice
> installed, you might be able to script those to import from tab- 
> delimited
> and export to CSV. Admittedly that is like using a nuke to kill a fly.

Actually, the problem arises because I have a client who is exporting  
a 'database' file from Excel 2000 (don't ask), to .csv, and Excel is  
so stupid that it is not putting quotes around a field that contains  
commas. Duh.

Excel seems to export to tab-delimited format without making any  
fatal errors, but I need a real .csv file for import.

Thus my need to convert from tab to (real) csv.

-- John




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?30696042-D9B5-4239-A560-00D20DBE5177>