Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 11/03/84 (WLS Mods); site astrovax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!astrovax!wls From: wls@astrovax.UUCP (William L. Sebok) Newsgroups: net.bugs.4bsd Subject: Re: Possible bug in awk? Message-ID: <574@astrovax.UUCP> Date: Tue, 9-Apr-85 11:58:31 EST Article-I.D.: astrovax.574 Posted: Tue Apr 9 11:58:31 1985 Date-Received: Wed, 10-Apr-85 05:39:06 EST References: <1143@topaz.ARPA> Organization: Princeton Univ. Astrophysics Lines: 20 > I have been trying to do some stuff with awk that I saw in an > example in one of the Unix books and it doesn't work as I thought. > It seems to me that the line: > > echo "This is a test" | awk {$1 = "Foo"; print} > > should print out "Foo is a test" but all I get when I try it is the > original line. > Is this a bug in awk? I get "Foo is a test". However I had to put single quotes around the argument to awk to protect them from the shell (either sh or csh). Could that be part of the problem? I also vaguly remember long ago installing a 4.2 BSD awk bugfix from Bill Shannon of Sun that had something to do with fixing the behavior of assigment to positional parameters. -- Bill Sebok Princeton University, Astrophysics {allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!wls