Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!zehntel!dual!amd!decwrl!decvax!cca!ima!ism780b!jim
From: jim@ism780b.UUCP
Newsgroups: net.unix-wizards
Subject: Re: How to pass /bin/sh parameters into
Message-ID: <56@ism780b.UUCP>
Date: Wed, 15-Aug-84 00:35:44 EDT
Article-I.D.: ism780b.56
Posted: Wed Aug 15 00:35:44 1984
Date-Received: Fri, 10-Aug-84 02:29:49 EDT
Lines: 30
Nf-ID: #R:iham1:-17500:ism780b:28500012:000:691
Nf-From: ism780b!jim    Aug  6 21:19:00 1984

Rather than either

	awk "BEGIN{id=$2;}{
		printf(\"%8d %s\\n\", id++, \$0);
		}" $1

or

	awk "
	BEGIN	{id=$2;} "'
		{ printf ("%8d %s\n", id++, $0); }
	' $1

I much prefer

	awk '
	BEGIN   {id='"$2"';}
		{ printf ("%8d %s\n", id++, $0); }
	' $1

i.e., always use single quotes to surround awk scripts,
and include Shell variables (or `` substitutions) within '" and "' .

>The 'awk' manual page talks about passing parameters via the command
>line, but I've never been able to make it work and the source for
>awk does not seem to attempt to obtain such parameters anyhow.  Who knows?

That feature is only available as of System V release 2.

-- Jim Balter, INTERACTIVE Systems (ima!jim)