home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10188 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  2.8 KB

  1. 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
  2. From: sgr@alden.UUCP (Stan Ryckman)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Awk Variables
  5. Message-ID: <516@alden.UUCP>
  6. Date: 19 Aug 92 18:57:26 GMT
  7. References: <1992Aug10.003934.24269@jpradley.jpr.com> <510@alden.UUCP> <Bt6v2A.6CM@root.co.uk>
  8. Sender: usenet@alden.UUCP
  9. Organization: Alden Electronics, Westboro, MA
  10. Lines: 58
  11.  
  12. In article <Bt6v2A.6CM@root.co.uk> gwc@root.co.uk (Geoff Clare) writes:
  13. >In <510@alden.UUCP> sgr@alden.UUCP (Stan Ryckman) writes:
  14. >>  Old awk's don't take var1=value1 type arguments.
  15. [stuff deleted]
  16. >
  17. >I expected to see this guy flamed to a crisp
  18.  
  19. Now who would do that? :-)
  20.  
  21. >but I haven't seen a single
  22. >followup here, so I'll stick my oar in.
  23.  
  24. Come on in, the water's fine!
  25.  
  26. >Old awks DO take var=value arguments.  I have never come across a version
  27. >of awk that did not.
  28.  
  29. Uh-oh, my age is showing :-).  I believe I tried var=value upon seeing
  30. it in a "new" awk book in 1987 or so, but it would not work (and was
  31. not in the man pages or manual) on an OS version from the early 1980's
  32. or so.  (As I remember, the book described many "new" features in
  33. awk differing from the original awk, and may have been authored by
  34. one of the a-w-k trio.)  For years I had wanted something like this
  35. feature but didn't have it.  I had had to kludge messy scripts to
  36. construct 'BEGIN{...}' stuff and combine with the desired awk script.
  37.  
  38. Can't prove it today though; the oldest awk on our systems now is
  39. dated May 1989, and all take var=value; and I don't have the book (it
  40. wasn't my copy).
  41.  
  42. >The only difference in this feature between old and
  43. >new awk is that if you want to set a variable on the command line AND
  44. >read standard input, you have to put an explicit "-" as a file name with
  45. >old awks, but new awks shouldn't need it.
  46.  
  47. Our System V 3.2 awk does need the "-"; our SunOS 4.1.1 awk does not.
  48. On either system, "nawk" does not.  But by "old" I meant quite a bit
  49. farther back than these versions date.
  50.  
  51. (BTW, I was referring only to "awk", not to "nawk" or "gawk" or ... .
  52. I suspect that these variants may well have always accepted var=value,
  53. just because it's so useful, and since they probably postdate the
  54. change.)
  55.  
  56. And even if I were to turn out to be completely wrong about the above,
  57. you would not convince me that it was a wise syntactical decision,
  58. _whenever_ it was perpetrated, that
  59.     awk '{print}' a2
  60. and
  61.     awk '{print}' a=2
  62. should behave so differently.  It's bad enough that filenames starting
  63. with "-" or "~", or containing white space, cause so many scripts
  64. and commands to behave incorrectly.  My gripe still applies.
  65.  
  66. Stan.
  67. --
  68. This .signature has expired.  Call 1-900-YOU-FOOL to find out why.
  69.     Stan Ryckman   sgr@alden.UUCP
  70.