awk script fails on solaris 2.4

awk script fails on solaris 2.4

Post by Jongleu » Wed, 04 Feb 1998 04:00:00




> G'Day,
> the awk script below works as intended on a Linux (Red Hat 4.1) and on a
> SCO 2 box.
> The target machine is a Solaris 2.4.  When I run it on the Solaris box
> I get the following errors -
> awk: syntax error near line 2
> awk: illegal statement near line 2
> awk: syntax error near line 4
> awk: bailing out near line 4

> The synatax seems OK to me and I can't find anything in the Solaris awk
> man pages which says it has a different synatax.  Sorry I could find no
> obvious way of determining the awk that is running on the Solaris box.

> Thanks
> Murray

>  awk '{
>   if (match($0, /BSIC/) == 30){
>    exit 1
>   } else {
>    if (substr($0, 30, 1) == " ") {
>     print substr($0, 0, 29) substr($0, 31)
>    } else {
>     print
>    }
>   }
>  }' $file > temporary_file

> --
> Murray Barton                     Perth, Western Australia

> When a man despoils a work of art we call him a vandal; when he despoils
> a work of nature we call him a developer. - Joseph Wood Krutch

On the sun station, did you try to use 'nawk' in place of 'awk'?

('nawk' stands for "new awk"...   and it should be there too...
Unfortunately, I do not have access to a Sun machine to confirm it.)

This little hint got me out of the jam when I tried to make a awk script
work under Intergraph's CLIX, IBM's AIX, and HP's HP-UX...

Regards, Serge

 
 
 

awk script fails on solaris 2.4

Post by Chris Gr » Thu, 05 Feb 1998 04:00:00



Quote: writes:

> On the sun station, did you try to use 'nawk' in place of 'awk'?

You could always try looking for /opt/gnu/bin/gawk - never know your luck.

--

  Chris Gray

 
 
 

awk script fails on solaris 2.4

Post by Patrick TJ McPh » Fri, 06 Feb 1998 04:00:00



% >
% > G'Day,
% > the awk script below works as intended on a Linux (Red Hat 4.1) and on a
% > SCO 2 box.
% > The target machine is a Solaris 2.4.  When I run it on the Solaris box
% > I get the following errors -
[...]

% On the sun station, did you try to use 'nawk' in place of 'awk'?
%
% ('nawk' stands for "new awk"...   and it should be there too...
% Unfortunately, I do not have access to a Sun machine to confirm it.)

In fact, on Solaris (at least up to 2.51), awk is old awk and nawk is new
awk.

For a long time, on Sun machines, troff was C/A/T troff, rather than ditroff,
although they've now left that behind them. Perhaps they will leave old awk
behind them some day, too.
--

Patrick TJ McPhee
East York  Canada

 
 
 

awk script fails on solaris 2.4

Post by Kuntal M. Daftar » Fri, 06 Feb 1998 04:00:00



>  awk '{
>   if (match($0, /BSIC/) == 30){
>    exit 1
>   } else {
>    if (substr($0, 30, 1) == " ") {
>     print substr($0, 0, 29) substr($0, 31)
>    } else {
>     print
>    }
>   }
>  }' $file > temporary_file

use back slashes to end the lines. awk (AFAIK) is not a multi line command.

Kuntal Daftary
1.408.527.9789

 
 
 

awk script fails on solaris 2.4

Post by Patrick TJ McPh » Sat, 07 Feb 1998 04:00:00





%
% >  awk '{
% >   if (match($0, /BSIC/) == 30){
% >    exit 1
% >   } else {
% >    if (substr($0, 30, 1) == " ") {
% >     print substr($0, 0, 29) substr($0, 31)
% >    } else {
% >     print
% >    }
% >   }
% >  }' $file > temporary_file
%
% use back slashes to end the lines. awk (AFAIK) is not a multi line command.

There are circumstances where this is necessary, but not in this case. However,
compare
 nawk '{
   print $1,
         $3
 }'
with
 nawk '{
   print $1
         $3
 }'
and
 nawk '{
   print $1\
         $3
 }'
--

Patrick TJ McPhee
East York  Canada

 
 
 

awk script fails on solaris 2.4

Post by p.. » Tue, 10 Feb 1998 04:00:00



: >  awk '{
: >   if (match($0, /BSIC/) == 30){
: >    exit 1
: >   } else {
: >    if (substr($0, 30, 1) == " ") {
: >     print substr($0, 0, 29) substr($0, 31)
: >    } else {
: >     print
: >    }
: >   }
: >  }' $file > temporary_file

Your problem is probably based on the oawk/nawk version problem.
On Sun boxes (and others), try "nawk" rather than "awk".  Generally,
If nawk exists on your machine, use it.  On machines where there is
no nawk, they've renamed it to awk.

[ As an aside, has anyone on any platform encountered problems by replacing
awk with nawk themselves?  ARE there any compatability problems moving
from awk to nawk?  All code I have seen is upwardly compatable. ]


: use back slashes to end the lines. awk (AFAIK) is not a multi line command.

The need for backslashes at the end of awk lines is imposed by the SHELL you
are using (not awk).  csh and its derivatives do not allow multi-line quoted
strings.  This is one reason I switched to a posix shell based on Bourne-shell,
as I write a LOT of in-line awk code.
--

 
 
 

1. Solaris 2.4 x86 Bus Mouse Install Fails

My 2.4 x86 installation fails when trying to install the driver for
the Microsoft Bus Mouse (msm).  The following error is
displayed:

drvconfig: system call 'modctl_modconfig' failed: no such device or address

I am using an ATI Graphics Ultra + which has the Bus mouse on-board.
On the Windows and DOS side the mouse is working fine.

contents of /kernel/drv/msm.conf
class="sysbus" name="msm" ioaddr=0x23C intr=1,5;

I try adding the driver by executing 'drvconfig -i msm' and keep
getting the error mentioned above.  

I have not installed any patches or anything like that.  Anybody out
there have any suggestions besides buying more new hardware?

Thanks in advance,

Steve Pamer

2. FreeBSD 4.0 can't see one of my scsi hard drives

3. listen() fails with EPROTO on Solaris 2.6, not on 2.4

4. Sol9: ownership of /tmp

5. Solaris 2.4 installation fails

6. rsh and security under solaris 2.4

7. Solaris 2.6 Upgrade Fails with Volume Manager 2.4

8. how to create mksysb bootimage on disk?

9. xemacs 19.12 fails after Solaris 2.4 patch install

10. gethostbyaddr() fails, Solaris 2.4? HELP please

11. Solaris 2.4 upgrade fails on Fujitsu M2694ESA disk - help!

12. wu-ftpd 2.4, Solaris, failed PASV connect from anonymous

13. Emacs 19.28 on Solaris 2.4 fails on temacs loadup