Charles Calvert wrote:
> Since we're engaging in a little friendly pedantry...

:-)

> On 10/27/2009 6:30 AM, Keith MARSHALL wrote:
>
> [attributions added back in]

This utterly abysmal mail client, which my employer insists I use, messes
them up horrendously; sorry about that.

>> On 10/23/2009 10:56 AM, Charles Calvert wrote:
>
>>> On 10/23/2009 10:31 AM, bradda...@comcast.net wrote:
>>
>>>> I can't seem to get awk to work.
>>>> Here is the command line I'm trying to use:
>>>>
>>>> svn ls -R | awk "print $1"
>>> Try:
>>>
>>>            svn ls -R | awk "{print $1}"
>>>
>>> The default rule must be enclosed in braces.
>>
>> Actually, this is not strictly so; while your suggested remedy
>> is correct in this instance, your explanation is wrong.
>>
>> An awk "rule", (usually called a "statement",
>
> Most of my understanding of awk comes from "Effective awk Programming"
> and "sed & awk" in which Mr. Robbins tends to use the word "rule" rather
> than the word "statement", so I think that "usually" depends on the
> context.  I would agree that "statement" has a more well defined meaning
> in a programming context, but plenty of programming languages have their
> little variations on terminology.

I didn't mean to impugn your use of the word "rule"; just introducing
what I believe to be the more common terminology, esp. in the formal
documentation of awk, (where, FTR, my "match-criterion" is usually
referred to as a "pattern"; see:
   http://www.opengroup.org/onlinepubs/009695399/utilities/awk.html ).

>> for it is a part
>> of an awk "script" which itself comprises one or more of such
>> statements), comprises two parts:
>>
>>       match-criterion { action [; ...] }
>>
>> It's the *action* part of the statement which must be enclosed
>> in braces, and this applies to *all* statements;
>
> I did not imply the opposite.  Brad failed to enclose the action in
> braces and I stated that he needed to do so.

Exactly so; your suggested remedy was correct, as I said.  However...

>  I don't see how one can
> reasonably conclude that this implies that braces should not enclose
> any other action.  Perhaps I have misunderstood your use of emphasis
> in this case?

I thought your wording may have been potentially confusing; you stated
that "the default *rule* must be enclosed in braces" (my emphasis), but
if we accept, in your terminology, that "rule" is synonymous with the
"statement" of mine, then that would be incorrect: it is only the
*action* part of the "rule" which must be enclosed in braces, (and
there really isn't any realistic concept of a "default rule"; the awk
language specification allows *either* the pattern or the action to be
defaulted, but never both in the same statement).

>> (in fact, if any statement is given at all, there is no applicable
>> concept of a "default"; any statement may omit either the
>> match-criterion part, which then defaults to matching *every* input
>> line, or it may omit the action part, which then defaults to echoing
>> the entire matched input line to the output stream.
>
> I should have said the "empty pattern"[1], but my mind came up with
> "default" instead.

Ah!  With that qualification, your analysis becomes correct, if not as
clearly expressed as it might have been.

> Thanks for the clarification.

You're welcome.  I thought it necessary, to avoid possibly confusing an
OP who clearly isn't experienced in awk programming.

--

Regards,
Keith.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
GnuWin32-Users mailing list
GnuWin32-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuwin32-users

Reply via email to