Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2009 12:20:29 -0500
From:      John Almberg <jalmberg@identry.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: tab-delimited to csv
Message-ID:  <93A09B23-28A6-4AF6-B8F3-FA607699A63A@identry.com>
In-Reply-To: <49999F6B.4020400@gmail.com>
References:  <A1268853-0066-4604-AB9E-7D45E738BF32@identry.com> <49999F6B.4020400@gmail.com>

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

On Feb 16, 2009, at 12:16 PM, Adam Vande More wrote:

> John Almberg wrote:
>> Can anyone suggest a way to convert a tab-delimited file to csv =20
>> using standard unix utilities? I could whip up a Ruby script to do =20=

>> it, but I hate to reinvent the wheel.
>>
>> Thanks: John
>> _______________________________________________
>> freebsd-questions@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>> To unsubscribe, send any mail to "freebsd-questions-=20
>> unsubscribe@freebsd.org"
> if you just dealing with a few files, you could use thing like vi =20
> or and editor w/ regex capbilites to search and replace tabs w/ =20
> comma's.
>
> perl -pe =92s/\t/,/g=92 table.tsv > table.csv

There's more to csv than commas, though. For example, if one of the =20
fields contains commas, you need to wrap the field with quotes.

-- John




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?93A09B23-28A6-4AF6-B8F3-FA607699A63A>