Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Awk Error

82 views
Skip to first unread message

chettiar

unread,
Sep 13, 2006, 5:45:29 AM9/13/06
to
I am trying to execute the following on AIX

echo testing | awk '{x} {print substr($x,1,3)}'

But it comes out with the following error:

awk: 0602-550 A statement occurred that is not valid.

The input line number is 1.

The source line number is 1.


Can someone pls tell me what is it that i have gotten wrong. The same
thing is working on another server. Is there any configruation or
profile setting which I am missing

Juergen Kahrs

unread,
Sep 13, 2006, 5:53:29 AM9/13/06
to
chettiar wrote:
> I am trying to execute the following on AIX
>
> echo testing | awk '{x} {print substr($x,1,3)}'


With gawk 3.1.3 on Linux, I get this response:


echo testing | awk '{x} {print substr($x,1,3)}'

tes

You are using some ancient broken AWK implementation.

> But it comes out with the following error:
>
> awk: 0602-550 A statement occurred that is not valid.
>
> The input line number is 1.
>
> The source line number is 1.

It may be the substr() function which may be missing in the AWK on your AIX.
It may also be the semicolon (;) between the curly braces that you failed to insert.

chettiar

unread,
Sep 13, 2006, 8:24:17 AM9/13/06
to
How do I find the version of awk in AIX?
In linux i can do awk --version and it works

Ed Morton

unread,
Sep 13, 2006, 8:30:18 AM9/13/06
to
chettiar wrote:

> How do I find the version of awk in AIX?
> In linux i can do awk --version and it works

The fact that you can't do that is all you need to know. You're using
old, broken awk. Use GNU awk (gawk) or New awk (nawk) or
/usr/xgp4/bin/awk if you were on Solaris.

And please don't top-post.

Ed.

Juergen Kahrs

unread,
Sep 13, 2006, 9:04:48 AM9/13/06
to
Ed Morton wrote:

>> How do I find the version of awk in AIX?

AWK on our AIX 4.3 and 5.2 has no way to find out version.
But the man page suggests that the AWK on AIX is a nawk-variant.

>> In linux i can do awk --version and it works

Yes, that's a gawk in disguise.

0 new messages