Path: utzoo!mnetor!uunet!husc6!cmcl2!beta!dph From: dph@beta.UUCP (David P Huelsbeck) Newsgroups: comp.unix.questions Subject: Re: Using pipes within awk programs Message-ID: <14660@beta.UUCP> Date: 22 Jan 88 19:23:01 GMT References: <515@root44.co.uk> <2138@geac.UUCP> <3521@megaron.arizona.edu> Reply-To: dph@LANL.GOV.ARPA (David P Huelsbeck) Organization: Los Alamos Natl. Labs, Los Alamos, NM Lines: 29 Keywords: awk, pipe, Ultrix, bsd4.2, bugs Summary: Ultrix awk broken. In article <3521@megaron.arizona.edu> rupley@arizona.edu (John Rupley) writes: >In article <2138@geac.UUCP>, ivor@geac.UUCP (Ivor Williams) writes: >> In article <515@root44.co.uk> you write: >> > who | awk '{ print $1 | "sort" }' >> >gives the same output as >> > 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 >usage of sort and awk. Diff shows identical output for the above >two command lines, under BSD4.3 (old awk) and SysV rel2 (new awk). Yes. Ultrix awk is broken in more ways than that. I haven't tried this particular awk bug on BSD4.2 but I'll bet it's broken there too. BSD4.2 made some changes to awk. Since 4.3 came out very shortly after I became interested in awk I've never looked to see exactly what they did or why. However the changes they made introduced some errors that didn't exist before and were fixed in 4.3. The most obvious was that "$1 = foo" did not change the value of $0. So the old swaping two items in a line while leaving the rest intact didn't work any more. This was known by the time Ultrix came out but I guess they wanted to be bug for bug compatable. ;-) David Huelsbeck dph@lanl.gov.arpa {cmcl2|ihnp4}!lanl!dph