Article View: comp.bugs.sys5
Article #636Re: New (UnixTC) awk - warning
From: Brandon Allbery
Date: Sat, 31 Oct 1987 03:32
Date: Sat, 31 Oct 1987 03:32
31 lines
1756 bytes
1756 bytes
As quoted from <1697@culdev1.UUCP> by drw@culdev1.UUCP (Dale Worley):
+---------------
| root@investor.UUCP (Bob Peirce) writes:
| > 'BEGIN {
| > stuff
| > }{
| > more stuff
| > }'
| >
| > states on p.22 that "The opening brace of an action must be on the
| > same line as the pattern it accompanies."
|
| Eh? As far as I can tell, the pattern is an implied "all lines",
| physically represented by the null string immediately preceeding the
| open brace. And that null string is on the same line as the open
| brace.
| What am I missing?
+---------------
That the format of an awk "rule" is
pattern action \n
In particular, the pattern MUST be the first thing on the line. I have been
writing awk scripts with this in mind the whole time that I have used awk;
as a result, my scripts are compatible. Using undocumented behavior is a
good way to be burned by changes to a program.
--
Brandon S. Allbery necntc!ncoast!allbery@harvard.harvard.edu
{harvard!necntc,well!hoptoad,sun!mandrill!hal,uunet!hnsurg3}!ncoast!allbery
"Uncle _who_?" -- Lt. Worf ^^^^^^^^^^^^^ NOTE NEW PATH!
Technical Details
Message-ID:
<4966@ncoast.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!tektronix!decvax!decwrl!pyramid!uccba!hal!ncoast!allberyReferences:
<1697@culdev1.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!tektronix!decvax!decwrl!pyramid!uccba!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: comp.bugs.sys5,comp.lang.misc Subject: Re: New (UnixTC) awk - warning Message-ID: <4966@ncoast.UUCP> Date: Fri, 30-Oct-87 22:32:15 EST Article-I.D.: ncoast.4966 Posted: Fri Oct 30 22:32:15 1987 Date-Received: Thu, 5-Nov-87 06:30:21 EST References: <1697@culdev1.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.bugs.sys5 Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 31