mmartin@orphee.inria.fr (Michel MARTIN) (10/01/90)
When I type awk ' { while (getline <"lettre" > 0 ) } ' I've an error like awk: syntax error near line 1 awk: illegal statement near line 1 Does someone knows a solution please tanks a lot -- Michel Martin INRIA Sophia Antipolis Tel: (33) 93 65 77 23 2004, Route des Lucioles Fax: (33) 93 65 77 65 BP 109 - 06561 Valbonne Cedex (France) Telex: INRIASA 970 050 F Email: Michel.Martin@mirsa.inria.fr
booker@network.ucsd.edu (Booker bense) (10/02/90)
In article <8678@mirsa.inria.fr> mmartin@orphee.inria.fr (Michel MARTIN) writes: >When I type > > awk ' { while (getline <"lettre" > 0 ) } ' > >I've an error like > > awk: syntax error near line 1 > awk: illegal statement near line 1 > >Does someone knows a solution please >tanks a lot - You probably have an older version of awk than the one documented in the book " The Awk Programming Language" by A. W. & K. . The one in the book doesn't come with most unix systems. You have to buy it from ATT. They also have a nifty tool I wish we could get which takes awk programs and writes c code. I haven't found a way to get older awk to read more than one file. Mostly I get around this by using multiple awk programs that pipe output into each other. Booker C. Bense /* benseb@grumpy.sdsc.edu */ grep ?!$ Isn't that something that sticks to your shoes ? %-) &-) 8-)
fitz@mml0.meche.rpi.edu (Brian Fitzgerald) (10/03/90)
In article <8678@mirsa.inria.fr> mmartin@orphee.inria.fr (Michel MARTIN) writes: >When I type > > awk ' { while (getline <"lettre" > 0 ) } ' > If you are using GNU awk, eliminate the error by specifying a body for the while loop. If you want no action, use ";", as in gawk ' { while (getline <"lettre" > 0 ) ; } ' Additionally, if you are using Sun awk, I don't think you can use input redirection with getline. The following runs without error in Sun awk. awk ' { while (getline > 0 ) ; } ' Gawk is available by anonymous ftp from prep.ai.mit.edu (and many sites in Europe as well.) I believe that to compile gawk, it is helpful to get "bison" and "gcc", which are available from the same place.
guy@auspex.auspex.com (Guy Harris) (10/04/90)
>Additionally, if you are using Sun awk, I don't think you can use input >redirection with getline. The following runs without error in Sun awk. "Sun awk" should probably be replaced by "old awk" in the above. "Sun awk" is basically either BSD "awk" (which is basically V7-addendum-tape "awk") prior to SunOS 3.2, or S5R2 "awk" in 3.2 and later (AT&T sped it up a fair bit after the V7 addendum tape version came out). (The only Sun additions are minor null-pointer-dereferencing fixes and, as I remember, a tweak to allow "-" to stand for "standard input" when used as a program file name.) GNU "awk" ("gawk") implements "new awk", which is the "awk" described by the AWK book; AT&T also has a "new awk" implementation, available in S5R3.1 and later and also available from the AT&T Toolchest. SunOS 4.1 has AT&T's S5R3.1 "new awk" implementation (again, with null-pointer-dereferencing fixes; too bad the damn 3B2 ABI for S5R4 doesn't forbid location 0 being part of the address space, if it did maybe all those frigging null pointer dereferences in the porting base source would get FIXED).