Awk Field Separators

Jeff Riegel jeffr at bcs800.UUCP
Fri Aug 24 05:06:50 AEST 1990


In <3729 at se-sd.SanDiego.NCR.COM> cubbage at se-sd.SanDiego.NCR.COM (Sharon Cubbage) writes:


>Does anybody know how to specify more than one field separator in Awk?
>I would like to specify to an Awk program to treat single spaces as well
>as bars as field separators so that a string such as :

>12 12 12 34|34|34

>will be said to have 6 fields.  I've tried to create a regular expression
>to handle both cases but it hasn't been working.

>Any hints?

>Thanks!
>Sharon

How about using tr to comvert "|" to " ", and if you need 1the "|"'s use
awk and printf to recreate the new file properly delimited...



More information about the Comp.unix.questions mailing list