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 using standard unix utilities? I could whip up a Ruby script to do 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- unsubscr...@freebsd.org"
if you just dealing with a few files, you could use thing like vi or and editor w/ regex capbilites to search and replace tabs w/ comma's.

perl -pe ’s/\t/,/g’ table.tsv > table.csv

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

-- John

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to