awk question 
Author Message
 awk question


Quote:




>> > How do you concatenate strings in the awk programming language?

>>     man awk
>>     /concatenat

>>    Operators
>>        The operators in AWK, in order of decreasing precedence, are
>>        [.....]
>>        space       String concatenation.

Language nitpick follows.

And, note, the above quote is valid (from "man gawk").

I never thought of "space" as the "concatenation operator" in AWK.  I
always understood simple juxtaposition to be sufficient.  Observe:

% gawk 'BEGIN{print "hi""bye","hi"6+2}'
hibye hi8
%

In fact, (with the exception(s) as noted below), I can't think of anyplace
in AWK where a space is significant, other than within double quotes.

Exception(s): There is at least one place where the presence or absence of
a space is necessary to avoid a syntactic ambiguity.  One such place is
described below:

    The left parenthesis in  a  function  call  is  required  to
    immediately  follow the function name, without any interven-
    ing white space.  This is to  avoid  a  syntactic  ambiguity
    with  the concatenation operator.  This restriction does not
    apply to the built-in functions listed above.

There may be others.



Sun, 24 Apr 2005 20:57:17 GMT  
 awk question
...
Quote:
>In fact, (with the exception(s) as noted below), I can't think of anyplace
>in AWK where a space is significant, other than within double quotes.

...

Try juxtaposing two variable name tokens like foo and bar.

BEGIN { foo = "K"; bar = "M"; print foobar }

Whitespace is necessary at times to resolve user-defined tokens. It's not an
operator, but it does serve a syntactic purpose.



Mon, 25 Apr 2005 03:37:20 GMT  
 awk question

Quote:


>...
>>In fact, (with the exception(s) as noted below), I can't think of anyplace
>>in AWK where a space is significant, other than within double quotes.
>...

>Try juxtaposing two variable name tokens like foo and bar.

>BEGIN { foo = "K"; bar = "M"; print foobar }

>Whitespace is necessary at times to resolve user-defined tokens. It's not an
>operator, but it does serve a syntactic purpose.

heh - good point.

Or even: printsin(0)



Mon, 25 Apr 2005 03:47:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Simple awk question

2. A Newbie AWK question

3. awk question about matching a pattern

4. AWK question

5. newbie awk question

6. awk questions !!!

7. Simple awk question

8. Easy Awk Question

9. Awk question.

10. awk Question

11. awk question

12. awk question

 

 
Powered by phpBB® Forum Software