Return to BSD News archive
Path: sserve!manuel!munnari.oz.au!mips!mips!sdd.hp.com!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!uw-beaver!ssc-vax!brennan From: brennan@ssc-vax.boeing.com (Mike Brennan) Newsgroups: comp.unix.bsd Subject: Re: awk/mawk bug??? Keywords: awk Message-ID: <5433@ssc-bee.ssc-vax.boeing.com> Date: 10 Aug 92 16:30:36 GMT References: <2472@nic.cerf.net> Organization: Boeing Computer Services Lines: 32 In article <2472@nic.cerf.net>, greggb@nic.cerf.net (Gregg Brekke) writes: > #--- begin ---- > s="at;be;ca" > > site=`echo $s | awk '{FS = ";" ; print $1}'` > > echo $site > > - output on Sun/Interactive - > at > > - output on 386bsd w/mawk - > at;be;ca > This is an awk bug, not a mawk bug. The record is read *before* the assignment to FS, so when the record is read FS is " ". awk -F';' '{print $1}' or awk 'BEGIN{FS=";"} ; {print $1}' should work with any flavor of awk. -- Mike Brennan brennan@boeing.com