Why is it that PC-DOS and Windows ilk have the worst data formats? even something that ought to be reasonable, such as text... is botched up so bad you can't easily parse it with regular expressions.
.. Thats right, I'm talking about those notorious CSV files windows users are so fond of.
This tiny utility will convert these CSV files into TSV files so that you can work on them with awk, cut, sed, etc.. it handles embedded tabs, newlines, carriage returns with a printf-like escape characters.
csv2tab <infile.csv >outfile.tab
Where infile might be:
"peggy.wanger@example.com",39,"Hoola<tab>Hoops"
Outfile will be
peggy.wanger@example.com<tab>39<tab>Hoola\tHoops
It's a very simple little C program (and I'm not really a C programmer..) I'm putting it into the public domain in the hopes that the maintainers of various text processing packages pick it up.
We really need a standard utility like this on unix boxen' to deal with CSV files, since they seem to be so common (and I couldn't find a simple way to do this using awk or perl, w/out loading in a CSV module or something)
Just unpack the tarfile and run make OPTS="-Os" (or, just plain make)
Questions, comments or requests? Contact us