Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!killer!dcs!wnp From: wnp@dcs.UUCP (Wolf N. Paul) Newsgroups: comp.unix.questions Subject: Re: AWK User Assistance Message-ID: <65@dcs.UUCP> Date: 23 Apr 88 13:54:53 GMT References: <307@dsacng1.UUCP> Reply-To: wnp@dcs.UUCP (Wolf N. Paul) Organization: DCS, Dallas, Texas Lines: 32 Keywords: unix AWK assistance Summary: Most AWKs are not the version in the book In article <307@dsacng1.UUCP> nab1382@dsacng1.UUCP (Dick Hauser) writes: >I purchased the book "The AWK Programming Language". Right now, >I am working my way through the book. I have encountered problems >with user-defined functions (Page 53). I am familiar with "C" ... > { init_rpt() > print $1, $2 $3 > } > function init_rpt { > print " SAMPLE HEADER" > } >As a last resort, I wrote a small program like the one above, but >still received errors (syntax error near xxx, bailing out near xxx). >I read paragraph 2.3 (User-Defined Functions) quite a few times, and >can locate the problem. Apparently, there is a syntax requirement The syntax requirement is to have the right version of AWK. The AWK distributed with most UNIX systems to date is not the latest version of AWK, and supports neither user-defined functions nor access to more than one file in a program. I believe that the latest version, as described in the book, is being distributed with System V/3 only; it is also available from the AT&T Toolchest, although I do not know quite what the requirements are for that. If you have a 286 running either Microport or Xenix System V, you can get a reverse-engineered workalike from Mortice Kern Systems in Waterloo, Ontario, UNIX mail address ihnp4!watmath!mks!toolkit. Cost for a package including AWK, KSH and CRYPT is ca. $99. Hope this saves some readers of the AWK book these same frustrations I went through until I discovered that I had the wrong version of awk. -- Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101 UUCP: ihnp4!killer!dcs!wnp ESL: 62832882 INTERNET: wnp@EESDES.DAS.NET or wnp@dcs.UUCP TLX: 910-280-0585 EES PLANO UD