home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!microsoft!hexnut!a-kevinp
- From: a-kevinp@microsoft.com (Kevin Purcell)
- Subject: Problems with Awk under MPW
- Message-ID: <1992Nov12.231840.10436@microsoft.com>
- Date: 12 Nov 92 23:18:40 GMT
- Organization: Microsoft
- Lines: 56
-
-
- HELP! I have a problem thats driving me nuts, and I'm running out of time!
-
- I picked up awk as an MPW tool from one of our local Mac servers at
- Microsoft, there was no documentation provided so I presume it is
- somebodies freeware (no copyright in the version resource when viewed
- with Get Info...).
-
- Unfortunately when I run it with my script (see below) I get a Error
- message: invalid syntax on the third line of the script. This is not
- in the standard style (with [ and ] delimiting the area where awk
- thinks the error is) but MPW style File/line message. The precise
- position of the error is undefined.
-
- Playing with awk interactively shows the problem is not with the
- pattern /@/ but with the action. An empty action or just print works,
- but is a little useless in this case.
-
- Even
-
- /@/ {gsub(/foo/, "bar")}
-
- doesn't work, which worries me. I get the same error message if I do
-
- /@/ {foobar("anything")}
-
- I presume this means sub and gsub have been omitted for this version
- of awk. Anybody know the origins of this version? Are gsub() and sub() missing from this awk? How can it be awk
- if these are missing?. There is a lot of work predicated on this
- little script.
-
- Anybody know what "free" version of awk are out there for MPW? Does
- any documentation exist for these implementations describing their
- limitations (I have "the awk book"). References to a real MPW awk
- would be useful. Anybody know of any other tools that will do a
- similar job (match patterns and do arithmetic -- StreamEdit doesn't
- cut it unfortunately :-(
-
-
- Kevin Purcell, N7WIM/G8UDP
- a-kevinp@microsoft.com
- "I speak only for myself"
-
- The script is:
-
- # awk script to renumber variations in a markedup LLPT script
- # convert @s to the variation number
- # increment the variation number at the end of a variation
- #
- # Written by a-kevinp 11/10/92
-
- BEGIN { variation = 1 }
- /@/ { gsub( /@/, variation ); print }
- /label "var?*end"/ { variation++ }
-
- So simple ....
-