On Mon, 16 Feb 2009 11:55:50 -0500, John Almberg <jalmb...@identry.com> 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.
I think it's more simple with sed. Use the global substitution function, such as % sed "s/\t/:/g" See that \t or maybe [ \t]* may be the appropriate field delimiter. Instead of :, take , or . as separator, just as you need. Another solution could be awk. % awk '{ gsub("[\t]*", ":", $0); print $0; }' If you need additional re-ordering, use -F or FS to specify the field separator, and then printf "%s:%s:%s\n", $2, $1, $3;. These would be the easiest (I think) substitution approaches. -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... _______________________________________________ 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"