[lug] awk question

D. Frye dafr at peakpeak.com
Mon Jan 27 19:51:56 MST 2003


Harris, James wrote:
>>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

Off the top of my head I'm seeing what you want to search for, and not 
looking for the syntax that would be used. You appear to want to ignore 
the ", " and want to focus on the "[a-z],[a-z]".

Will that help you determine how to write your code?

David

-- 

D. Frye
dafr AT peakpeak.com
dafr AT freeshell.org
http://dafr.freeshell.org/




More information about the LUG mailing list