Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!bu.edu!mirror!necntc!necssd!harrison From: harrison@necssd.NEC.COM (Mark Harrison) Newsgroups: comp.unix.questions Subject: Re: Awk Field Separators Summary: You need New Awk (nawk). Message-ID: <427@necssd.NEC.COM> Date: 28 Aug 90 18:33:56 GMT References: <3729@se-sd.SanDiego.NCR.COM> Distribution: comp.unix.questions Organization: NEC America Inc. SSD, Irving, TX Lines: 22 In article <3729@se-sd.SanDiego.NCR.COM>, cubbage@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. The new version of Awk (nawk) can do this, but the old version can't. $ echo "a b,c" | nawk -F",| " '{print NF}' 3 $ echo "a b,c" | awk -F",| " '{print NF}' 2 -- Mark Harrison harrison@necssd.NEC.COM (214)518-5050 {necntc, cs.utexas.edu}!necssd!harrison standard disclaimers apply...