2 ms·
In general, I agree that CSV files are much easier to read and work with. The only issue I have is when fiddling with a CSV file where the data itself contains
by raboukhalil 12y ago
In general, I agree that CSV files are much easier to read and work with. The only issue I have is when fiddling with a CSV file where the data itself contains commas, e.g. in an address column. This makes parsing the file with awk more difficult than it should be (especially if you don't know about the commas in the first place!).
- juliangoldsmith 12y agoTSV files solve that problem nicely. Having worked extensively with TSV files, I'm not entirely sure why anyone would choose CSV over TSV, other than interfacing with something that only outputs CSV.
- lenzm 12y agoIt doesn't solve the problem, as there can be tabs in the data just like there can be commas. Tabs may be less common but it's still fundamentally the same.
- jandrese 12y agoGenerally it is best to use an actual CSV parser if you can. There are enough corner cases in it that a custom parser will almost never get everything. Plus, the libraries that implement CSV parsing are generally easy to use and self contained. The article waxed on about how easy it is to import a CSV into a spreadsheet, but I've found that Excel for instance has a pretty lousy CSV parser that is easy to confuse even if your file is properly escaped. Sometimes it is easier to convert the separator character to something that does not appear in your data (| or <tab> often works) instead of trying to escape and quote exceptions.