home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18359 < prev    next >
Encoding:
Text File  |  1992-11-12  |  2.2 KB  |  66 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!microsoft!hexnut!a-kevinp
  3. From: a-kevinp@microsoft.com (Kevin Purcell)
  4. Subject: Problems with Awk under MPW
  5. Message-ID: <1992Nov12.231840.10436@microsoft.com>
  6. Date: 12 Nov 92 23:18:40 GMT
  7. Organization: Microsoft
  8. Lines: 56
  9.  
  10.  
  11. HELP! I have a problem thats driving me nuts, and I'm running out of time!
  12.  
  13. I picked up awk as an MPW tool from one of our local Mac servers at
  14. Microsoft, there was no documentation provided so I presume it is
  15. somebodies freeware (no copyright in the version resource when viewed
  16. with Get Info...).
  17.  
  18. Unfortunately when I run it with my script (see below) I get a Error
  19. message: invalid syntax on the third line of the script. This is not
  20. in the standard style (with [ and ] delimiting the area where awk
  21. thinks the error is) but MPW style File/line message. The precise
  22. position of the error is undefined.
  23.  
  24. Playing with awk interactively shows the problem is not with the
  25. pattern /@/ but with the action. An empty action or just print works,
  26. but is a little useless in this case.
  27.  
  28. Even
  29.  
  30. /@/ {gsub(/foo/, "bar")}
  31.  
  32. doesn't work, which worries me. I get the same error message if I do
  33.  
  34. /@/ {foobar("anything")}
  35.  
  36. I presume this means sub and gsub have been omitted for this version
  37. of awk. Anybody know the origins of this version? Are gsub() and sub() missing from this awk? How can it be awk
  38. if these are missing?. There is a lot of work predicated on this
  39. little script.
  40.  
  41. Anybody know what "free" version of awk are out there for MPW? Does
  42. any documentation exist for these implementations describing their
  43. limitations (I have "the awk book"). References to a real MPW awk
  44. would be useful. Anybody know of any other tools that will do a
  45. similar job (match patterns and do arithmetic -- StreamEdit doesn't
  46. cut it unfortunately :-(
  47.  
  48.  
  49. Kevin Purcell, N7WIM/G8UDP
  50. a-kevinp@microsoft.com
  51. "I speak only for myself"
  52.  
  53. The script is:
  54.  
  55. # awk script to renumber variations in a markedup LLPT script
  56. #    convert @s to the variation number
  57. #    increment the variation number at the end of a variation
  58. #
  59. # Written by a-kevinp 11/10/92
  60.  
  61. BEGIN             { variation = 1 }
  62. /@/            { gsub( /@/, variation ); print }
  63. /label "var?*end"/     { variation++ }
  64.  
  65. So simple ....
  66.