Awk does not work on Solaris... 
Author Message
 Awk does not work on Solaris...

Hi All,
I have a simple script with inside it the following line:
BROWSER=`echo $BROWSER | awk '{t=$0;sub(/\/[^\/]*$/,"",t);print t}'`
The BROWSER variable could be /data/test/myprg.exe or /data/test/myprg
and the result
will be /data/test.
I test it on NT, OS/2, AIX without any problem I got the following error
running it on Solaris:
BROWSER=/data/test/dummy
+ echo /data/test/dummy
+ awk {t=$0;sub(/\/[^\/]*$/,"",t);print t}
awk: syntax error near line 1
awk: illegal statement near line 1
BROWSER=
Help !
Thanks,
            Paul


Fri, 16 Aug 2002 03:00:00 GMT  
 Awk does not work on Solaris...


Quote:
>Hi All,
>I have a simple script with inside it the following line:
>BROWSER=`echo $BROWSER | awk '{t=$0;sub(/\/[^\/]*$/,"",t);print t}'`
>The BROWSER variable could be /data/test/myprg.exe or /data/test/myprg
>and the result
>will be /data/test.
>I test it on NT, OS/2, AIX without any problem I got the following error
>running it on Solaris:
>BROWSER=/data/test/dummy
>+ echo /data/test/dummy
>+ awk {t=$0;sub(/\/[^\/]*$/,"",t);print t}
>awk: syntax error near line 1
>awk: illegal statement near line 1
>BROWSER=
>Help !
>Thanks,
>            Paul

Your email address bounces.

Chuck Demas
Needham, Mass.

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

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



Fri, 16 Aug 2002 03:00:00 GMT  
 Awk does not work on Solaris...
Previously, Paul Green wrote in comp.lang.awk:

Quote:
> + awk {t=$0;sub(/\/[^\/]*$/,"",t);print t}
> awk: syntax error near line 1
> awk: illegal statement near line 1

I've found that the awk that ships with Solaris is busted.  It does,
however, ship with nawk (new awk) which is not busted.  Try it instead.

Cheers,
Camz.

--

Camz Software Enterprises     www.passageway.com/camz/qnx/
QNX Programming & Consulting



Sat, 17 Aug 2002 03:00:00 GMT  
 Awk does not work on Solaris...

Please post to the group - though don't running Solaris, I'm
interested in the reply on that question also.

------------


Quote:
>Your email address bounces.



Sat, 17 Aug 2002 03:00:00 GMT  
 Awk does not work on Solaris...

Quote:

>Please post to the group - though don't running Solaris, I'm
>interested in the reply on that question also.

He'd emailed me, asking for help, and when I answered him it
bounced.

Here's what I'd said:

Date: Mon, 28 Feb 2000 12:22:52 -0500 (EST)


Subject: Re: Could you help me ?

Quote:

> Hi Charles,
> I tested your awk help on a Solaris box and it failed with the following
> error:
> BROWSER=/data/test/dummy
> + echo /data/test/dummy
> + awk {t=$0;sub(/\/[^\/]*$/,"",t);print t}
> awk: syntax error near line 1
> awk: illegal statement near line 1
> BROWSER=
> It worked fine on NT,OS/2 and AIX.
> Please, could you help me ?
> Thanks,
>                             Paul

Solaris has old awk installed, and it doesn't have/support the sub
function.

Fortunately it has nawk installed which is new awk and does support
the sub function.  Don't ask me why this is so, it just is.

You should use nawk or gawk on Solaris. IMO, gawk (GNU awk) is better
than nawk, but it might not be installed on your system.

Chuck Demas
Needham, Mass.

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

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



Sat, 17 Aug 2002 03:00:00 GMT  
 Awk does not work on Solaris...

Thank you. :)

-------------------------------


Quote:
>He'd emailed me, asking for help, and when I answered him it
>bounced.

>Here's what I'd said:

[---]


Sun, 18 Aug 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. awk script not working on SUN Solaris

2. Works in windows but not linux and solaris

3. AlphaTk not working in Solaris 2.6 and tcl/tk 8.2.1

4. exec ls *.java does not work on Solaris ??

5. ? Tcl-dp4.0b2 not work on Solaris 2.4

6. It worked on SCO but not RedHat awk

7. Simple awk script does not work?

8. Can this be done in AWK?

9. How is this done in awk/nawk/gawk?

10. Can this be done with AWK or ED ?

11. Does not work with TPS but works with DBF

12. 5.2 Network application works with 95, does not work with 98

 

 
Powered by phpBB® Forum Software