Possible bug in awk?

William L. Sebok wls at astrovax.UUCP
Wed Apr 10 02:58:31 AEST 1985


> 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



More information about the Comp.bugs.4bsd.ucb-fixes mailing list