Awk Field Separators

shun.cheung shun at cbnewsh.att.com
Thu Aug 23 07:24:28 AEST 1990


In article <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

This can be achieved by re-defining the field separator to be
a blank or a "|":

   FS = "[\ \|]"

-- 
-- Shun Cheung, AT&T Bell Laboratories, Middletown, New Jersey
     electronic: shun at hou2d.att.com,  att!hou2d!shun,  or shun at cbnewsh.att.com
       voice: (201) 615-5135



More information about the Comp.unix.questions mailing list