Lately I’ve been getting a few questions on why one should use .tsv
files
since CSVs are “standard” and virtually everyone knows how they work — so I wanted
to clarify this once and for all.
CSVs ARE A PAIN IN THE BACK. USE TSVs SINCE THEY LIKELY WON’T SCREW AROUND WITH YOUR SOURCE DATA.
To put it differently:
TSV is an alternative to the common comma-separated values (CSV) format, which often causes difficulties because of the need to escape commas – literal commas are very common in text data, but literal tab stops are infrequent in running text. The IANA standard for TSV achieves simplicity by simply disallowing tabs within fields.
Do yourself a favor and stop using CSVs, transition over to TSVs since they’re insanely less error-prone — say goodbye to sleepless nights trying to figure out why funny data has been uploaded to the DB.
If you’re worried about converting old CSV documents, python has the answer:
1 2 3 |
|
It’s then a matter of pipes: cat file.csv | csv2tsv.sh
and you’re done.