[X-Unix] Semi-newbe question

Xavier Noria fxn at hashref.com
Sun Nov 28 01:47:03 PST 2004


On Nov 28, 2004, at 4:30 AM, Russell McGaha wrote:

> Folks;
> 	I need a few pointers on an appropriate way to do the following:
> 		I've two files, call them file1 & file2.
> 		formated as follows: text1, text2, .... textx [return] ie [ascii 
> chr(13)]
> 						textxy, ..., textxx [return]
>
> (in other words a csv text file) and I need to take the coma's out and 
> replace them with returns.

A couple of questions:

The tricky part of this is to deal with the escaping rules. What 
happens when a field has a comma? Is the comma escaped with a 
backslash?

     foo,bar,this has a \, comma and a \\ backslash,baz,moo

Double quotes?

     foo,bar,"this is a , comma and a \" double quote and a \\ 
backslash",baz,moo

Are you sure the line separator is ASCII 13 and not ASCII 10?

-- fxn



More information about the X-Unix mailing list