Jun 24, 2015

TSV to CSV Quickie


Sed a very powerful editor on *IX/Mac allows to convert TSV to any delimited format. Basically a simple replacement in file which is quick and efficient.

sed "s/ /,/g" >

On linux box it is easier to identify a tab by \t however on mac one needs to press the Control + v and then hit the "tab" button.

The generic syntax to replace all occurrences of from_a with to_b is

sed "s/from_a /to_b/g" >

In case of optional delimiters also used when strings are always with double quotes (idiot sqldeveloper exporting data in my case"  following will do the trick
 sed -e 's#"##g' source  > destination

Use ">>" instead of ">" in case you want to append and not overwrite.