[lug] awk question

John E. Koontz koontz at boulder.nist.gov
Mon Jan 27 14:34:28 MST 2003


At 02:03 PM 1/27/2003 -0700, you wrote:
>How can I tell awk that ',' is the FS except when found within ""?  Is this
>going to be a portentially huge nightmare?  Perl really isn't an option cuz
>I don't know it (and don't really have the time to learn it -- reason #2,345
>that I need to learn perl).  The option to re-export the data with another
>FS is there, but not easy or quick... so if I can tell awk to deal with it
>quickly, then it's worth it, otherwise I'll take the human and compute
>cycles to re-export it.

A common strategy in cases like this is to do it in three steps:

- change comma in "" to something else unique
- change comma
- change the place-holders for comma in "" back

You need to be sure that "" is balanced within the range of a single record.
John E. Koontz
NIST 896.04 PCSG
303-497-5180

N39° 59' 42.1" W 105° 15' 49.7"




More information about the LUG mailing list