From owner-freebsd-questions@FreeBSD.ORG Mon Feb 16 18:25:51 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85DF810656BB for ; Mon, 16 Feb 2009 18:25:51 +0000 (UTC) (envelope-from amvandemore@gmail.com) Received: from imedmobility.com (host-50.216-16-29.iw.net [216.16.29.50]) by mx1.freebsd.org (Postfix) with ESMTP id 5B6848FC33 for ; Mon, 16 Feb 2009 18:25:51 +0000 (UTC) (envelope-from amvandemore@gmail.com) Received: from midco.net (host-47-73-107-208.midco.net [208.107.73.47]) by imedmobility.com (Postfix) with ESMTPSA id 9F2EF1173CAE for ; Mon, 16 Feb 2009 12:25:50 -0600 (CST) Message-ID: <4999AF98.30404@gmail.com> Date: Mon, 16 Feb 2009 18:25:28 +0000 From: Adam Vande More User-Agent: Thunderbird 2.0.0.18 (X11/20081225) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <20090216175556.GA53460@slackbox.xs4all.nl> <30696042-D9B5-4239-A560-00D20DBE5177@identry.com> In-Reply-To: <30696042-D9B5-4239-A560-00D20DBE5177@identry.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: tab-delimited to csv X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2009 18:25:52 -0000 John Almberg wrote: > > 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 > There is this: http://www.sat.dundee.ac.uk/arb/psion/ Have no idea if it complies or works as you want. But if you're dealing with just one so called "database" from Excel I would go with either checking the settings on the Excel export(in OO.org you can specify w/ or w/out quotes) as they may have missed the option. Or simply get the original file, open it in OO.org and do it from there as was basically suggested earlier. I would have thought something like would exist as it's certainly useful like dos2unix