[lug] awk question

Harris, James James_Harris at maxtor.com
Mon Jan 27 15:04:02 MST 2003


> Maybe your data isn't delimited like my example above.
> 

Yes, that is the case.  I probably should have included an example.  ;)

Very simple (standard problem)...

Type,Lastname,Firstname,DisplayName,etc,etc
Mailbox,Harris,Jim,"Harris, Jim",cow,chicken
Mailbox,Doe,John,"John Doe",etc,etc

The problem is in the DisplayName field.  In fundamental form, this is an
export from a database and in typical database style, it has exported the
"free string" fields with "" to protect the data within.  (This is a
directory export from MS Exchange for those that are wondering.)

The big problem is that free string area where I could in theory choose some
FS like "|" to allow for common things like ,; to show up, but there's no
gurantee.

As I stated previously, if it's complex, I'll just pick an FS that's highly
unlikely to show in the raw data and re-export it, but I thought I would try
to expand the brain KB and find out how to deal with this.  I hate to pull
the "but xxx can do it" excuse, but for example, when importing the file
into something like Excel or OpenOffice, it is handled properly... So I was
hoping that there might be such a function in tools like awk.

Thanks,
Jim



More information about the LUG mailing list