Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!umd5!purdue!gatech!udel!rochester!PT.CS.CMU.EDU!cadre!pitt!cisunx!cmf From: cmf@cisunx.UUCP (Carl M. Fongheiser) Newsgroups: comp.unix.questions Subject: Re: Using pipes within awk programs Message-ID: <6379@cisunx.UUCP> Date: 23 Jan 88 02:19:59 GMT References: <3521@megaron.arizona.edu> <20466@teknowledge-vaxc.ARPA> Reply-To: cmf@unix.cis.pittsburgh.edu (Carl M. Fongheiser) Organization: Univ. of Pittsburgh, Comp & Info Sys Lines: 31 In article <20466@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes: ]>> > who | awk '{ print $1 | "sort" }' ] ]>> > who | awk '{ print $1 }' | sort ] ]>> FYI, the two *don't* give the same results under Ultrix T2.0-1I. ] ]> Then Ultrix must be seriously broken, to not allow standard ] ]I think Ultrix awk is older than 4.3bsd's "old" awk. On Ultrix 1.2, ]the first form of pipe prints nothing. The second form prints a sorted ]list of logged in users. Ultrix 1.2's awk also has the bug where ]things like ] ] echo foo bar | awk '{ tmp = $1; $1 = $2; $2 = tmp; print $1, $2 }' ] ]don't work. That's how old it is. ] ]Mike Khaw That's funny -- I just tried these commands under both Ultrix 1.2 and 2.0. They worked fine! Incidentally, there is a difference between the first two commands. On Ultrix, the output of sort appears asynchronously when sort is started by awk -- as if awk didn't do a wait() on the process. Carl Fongheiser University of Pittsburgh Computing & Information Systems ...!pitt!cisunx!cmf cmf@pittvms.BITNET cmf%vms.cis.pittsburgh.edu@vb.cc.cmu.edu