From owner-freebsd-questions@FreeBSD.ORG Mon Feb 16 17:55:59 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 87A0B1065676 for ; Mon, 16 Feb 2009 17:55:59 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr16.xs4all.nl (smtp-vbr16.xs4all.nl [194.109.24.36]) by mx1.freebsd.org (Postfix) with ESMTP id 018678FC1C for ; Mon, 16 Feb 2009 17:55:58 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr16.xs4all.nl (8.13.8/8.13.8) with ESMTP id n1GHtvkA051570; Mon, 16 Feb 2009 18:55:57 +0100 (CET) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id CC945BA84; Mon, 16 Feb 2009 18:55:56 +0100 (CET) Date: Mon, 16 Feb 2009 18:55:56 +0100 From: Roland Smith To: John Almberg Message-ID: <20090216175556.GA53460@slackbox.xs4all.nl> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: by XS4ALL Virus Scanner 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 17:55:59 -0000 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =20 > standard unix utilities? I could whip up a Ruby script to do it, but =20 As long as the files don't contain commas themselves, it is a straightforward sed or perl command: replace '\t' with '","' And any field has internal double quotes, it becomes more difficult. See http://en.wikipedia.org/wiki/Comma-separated_values > 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 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. Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkmZqKwACgkQEnfvsMMhpyXa0ACeOUJAP/vBeNuT6igUPE84rC4x dbgAmwdFaDt7VMyBdVIP2N9nnd5ut5Nw =VRqk -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C--