What am I doing Wrong 
Author Message
 What am I doing Wrong

In The AWK Programming language page 58
{ print($1, $3) > ($3 > 100 ? "bigpop" : "smallpop") }
generate this error, any idea why?
awk: syntax error near line 1
awk: bailing out near line 1

--

                                        Regards
                                        Afshin Bozorgzadeh
                                        Tell: (617) 422-2339
                                        Fax : (617) 422-2801



Sat, 23 Dec 2000 03:00:00 GMT  
 What am I doing Wrong


Quote:
>In The AWK Programming language page 58
>{ print($1, $3) > ($3 > 100 ? "bigpop" : "smallpop") }
>generate this error, any idea why?
>awk: syntax error near line 1
>awk: bailing out near line 1

some versions of awk do not support the ? : operator.

Check your man page for awk.

gawk does support this operator.

BTW, on my system, my awk doesn't support the ? : operator, but my
version of gawk does.  YMMV.  :-)

Chuck Demas
Needham, Mass.

--
  Eat Healthy    |   _ _   | Nothing would be done at all,

  Die Anyway     |    v    | That no one could find fault with it.



Sun, 24 Dec 2000 03:00:00 GMT  
 What am I doing Wrong

% some versions of awk do not support the ? : operator.

<hobbyhorse>

It's worth pointing out that there was a revision of the language, oh,
about 10 years ago, and that some Unix vendors continue to ship the
original program with the name `awk', and the new, improved language
described in the book with the name `nawk'.

So, if awk doesn't understand the ? : operator, try nawk instead. If it's
your machine, you might consider renaming awk to oawk, and linking nawk
to awk, then changing any system scripts which use awk to use oawk instead,
on the chance they don't actually work with the new language.

Sun seems to be the last major hold-out on this issue.
</>

gawk, mawk, and tawk provide some additional features, mostly in the
way of additional built-in functions, but the syntax of the language
is consistent between the three.
--

Patrick TJ McPhee
East York  Canada



Mon, 25 Dec 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. What am I doing wrong!

2. What am I doing wrong?

3. Stupid newb question: What am I doing wrong?

4. what am i doing wrong

5. Help - What am I doing wrong

6. Saving a Variable to a field in a record- what am i doing wrong

7. What am I doing wrong?

8. What am I doing wrong?

9. #CONTROL What am I doing wrong

10. What am i doing wrong.

11. What am I doing wrong?

12. Clarion 5.5 What am I doing wrong????

 

 
Powered by phpBB® Forum Software