When your field-terminating char appears within field values

Posted by Jonathan Sampson on Super User See other posts from Super User or by Jonathan Sampson
Published on 2010-05-18T15:28:24Z Indexed on 2010/05/18 15:41 UTC
Read the original article Hit count: 418

Filed under:
|
|

I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation.

I'm currently using -t, to indicate that my fields are split by the comma character, but I'm finding that in some of my files, the comma is used (between double-quotes) within values:

Jonathan Sampson,,[email protected],0987654321
"Foobar CEO,","CEO,",[email protected],,

How can I use a comma to terminate my fields, but ignore the occurences of it within values? Is this fairly simple, or do I need to re-export all of my data using a more-foreign field-terminator?

© Super User or respective owner

Related posts about linux

Related posts about command-line