home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!news.byu.edu!news.mtholyoke.edu!nic.umass.edu!m2c!jjmhome!alden!alden.UUCP
- From: sgr@alden.UUCP (Stan Ryckman)
- Newsgroups: comp.unix.questions
- Subject: Re: Awk Variables
- Message-ID: <516@alden.UUCP>
- Date: 19 Aug 92 18:57:26 GMT
- References: <1992Aug10.003934.24269@jpradley.jpr.com> <510@alden.UUCP> <Bt6v2A.6CM@root.co.uk>
- Sender: usenet@alden.UUCP
- Organization: Alden Electronics, Westboro, MA
- Lines: 58
-
- In article <Bt6v2A.6CM@root.co.uk> gwc@root.co.uk (Geoff Clare) writes:
- >In <510@alden.UUCP> sgr@alden.UUCP (Stan Ryckman) writes:
- >> Old awk's don't take var1=value1 type arguments.
- [stuff deleted]
- >
- >I expected to see this guy flamed to a crisp
-
- Now who would do that? :-)
-
- >but I haven't seen a single
- >followup here, so I'll stick my oar in.
-
- Come on in, the water's fine!
-
- >Old awks DO take var=value arguments. I have never come across a version
- >of awk that did not.
-
- Uh-oh, my age is showing :-). I believe I tried var=value upon seeing
- it in a "new" awk book in 1987 or so, but it would not work (and was
- not in the man pages or manual) on an OS version from the early 1980's
- or so. (As I remember, the book described many "new" features in
- awk differing from the original awk, and may have been authored by
- one of the a-w-k trio.) For years I had wanted something like this
- feature but didn't have it. I had had to kludge messy scripts to
- construct 'BEGIN{...}' stuff and combine with the desired awk script.
-
- Can't prove it today though; the oldest awk on our systems now is
- dated May 1989, and all take var=value; and I don't have the book (it
- wasn't my copy).
-
- >The only difference in this feature between old and
- >new awk is that if you want to set a variable on the command line AND
- >read standard input, you have to put an explicit "-" as a file name with
- >old awks, but new awks shouldn't need it.
-
- Our System V 3.2 awk does need the "-"; our SunOS 4.1.1 awk does not.
- On either system, "nawk" does not. But by "old" I meant quite a bit
- farther back than these versions date.
-
- (BTW, I was referring only to "awk", not to "nawk" or "gawk" or ... .
- I suspect that these variants may well have always accepted var=value,
- just because it's so useful, and since they probably postdate the
- change.)
-
- And even if I were to turn out to be completely wrong about the above,
- you would not convince me that it was a wise syntactical decision,
- _whenever_ it was perpetrated, that
- awk '{print}' a2
- and
- awk '{print}' a=2
- should behave so differently. It's bad enough that filenames starting
- with "-" or "~", or containing white space, cause so many scripts
- and commands to behave incorrectly. My gripe still applies.
-
- Stan.
- --
- This .signature has expired. Call 1-900-YOU-FOOL to find out why.
- Stan Ryckman sgr@alden.UUCP
-