Scripting Question

Hal Burgiss hal at burgiss.net
Mon Feb 16 14:00:09 UTC 2009


On Mon, Feb 16, 2009 at 04:38:23AM -0800, Ray Parrish wrote:
> 
> I've been following this thread, and I just have to ask. Why would any 
> good program which generated csv output allow any embedded commas in the 
> data? That seems kind of counter productive to me. I would think that 
> any program which generated csv output, would replace any commas within 
> the data with a space or some other character, so that the csv file 
> would work as intended.

The question is how to protect an embedded delimiter, and I guess the
answer is that it has just evolved that way. There's actually an RFC
that defines the behavior. Wikipedia has a nice discussion of csv. All
this works quite well if using a language with csv support (python,
etc). I would think it would be difficult to handle all cases with
just traditional shell tools. Another unusual wrinkle is an embedded
double quote which is escaped as "". 

-- 
Hal





More information about the ubuntu-users mailing list