jaffe@topaz.ARPA (Saul) (04/08/85)
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? If I specify that I want $1, $2 etc printed I get the correct values. If this is a bug does anyone know of a fix??? -- Saul Jaffe Systems Programmer Rutgers University ARPA: Jaffe@Rutgers UUCP: ...{harvard,seismo,ut-sally,ihnp4!packard}!topaz!jaffe
wls@astrovax.UUCP (William L. Sebok) (04/09/85)
> 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
amoeba@botter.UUCP (Theo van der Storm) (04/10/85)
<395@botter.UUCP> cancelled from rn. -- Theo van der Storm, 52 20'N / 4 52'E, {seismo|decvax|philabs}!mcvax!vu44!tstorm