AWK User Assistance

Michael Morrell morrell at hpsal2.HP.COM
Sat Apr 23 04:32:46 AEST 1988


/ hpsal2:comp.unix.questions / nab1382 at dsacng1.UUCP (Dick Hauser) /  6:06 am  Apr 21, 1988 /
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"
and the bourne shell.  I wrote a small AWK program which called
a user-define function.  Syntax errors keep occurring.

     { 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
I am not aware of.  Finally, I you have a list of AWK "gotchas",    
I would appreciate receiving a copy.  

			   Thanks in advance -
			       Dick Hauser
----------

User-defined functions are only available in the 1985 version of awk (nawk).
You need to get a copy of that version.

   Michael



More information about the Comp.unix.questions mailing list