Awk Field Separators

Robert Felps felps at convex.com
Wed Aug 22 22:34:23 AEST 1990


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.

Try nawk(SV3.2 or later) or gawk from GNU!

nawk 'BEGIN { FS = "[ |]" }
{
# awk program ...
}'

------------------------------------------------------------------------------
| Robert Felps           |-The more you own,          | Tech. Assistant Ctr  |
| Convex Computer Corp   |  The more you have to fix! | OS System Specialist |
| 3000 Waterview Parkway |                            | felps at convex.com     |
| Richardson, Tx.  75083 |                            | 1(800) 952-0379      |
------------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list