From owner-freebsd-questions@FreeBSD.ORG Mon Feb 16 18:10:50 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 05B61106566C for ; Mon, 16 Feb 2009 18:10:50 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: from mx1.identry.com (on.identry.com [66.111.0.194]) by mx1.freebsd.org (Postfix) with ESMTP id 9411B8FC1A for ; Mon, 16 Feb 2009 18:10:49 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: (qmail 47283 invoked by uid 89); 16 Feb 2009 18:11:16 -0000 Received: from unknown (HELO ?192.168.1.110?) (jalmberg@75.127.142.66) by mx1.identry.com with ESMTPA; 16 Feb 2009 18:11:16 -0000 In-Reply-To: <20090216175556.GA53460@slackbox.xs4all.nl> References: <20090216175556.GA53460@slackbox.xs4all.nl> Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <30696042-D9B5-4239-A560-00D20DBE5177@identry.com> Content-Transfer-Encoding: 7bit From: John Almberg Date: Mon, 16 Feb 2009 13:10:47 -0500 To: Roland Smith X-Mailer: Apple Mail (2.753.1) Cc: freebsd-questions@freebsd.org 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:10:50 -0000 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