Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2009 18:55:56 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        John Almberg <jalmberg@identry.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: tab-delimited to csv
Message-ID:  <20090216175556.GA53460@slackbox.xs4all.nl>
In-Reply-To: <A1268853-0066-4604-AB9E-7D45E738BF32@identry.com>
References:  <A1268853-0066-4604-AB9E-7D45E738BF32@identry.com>

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

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090216175556.GA53460>