1828979 Members
2201 Online
109986 Solutions
New Discussion

Shell/Nawk/Compatibility

 
Mark Stewart_2
New Member

Shell/Nawk/Compatibility

I have written an oracle reporting program using shell and nawk on a solaris box.
The version of nawk I am using can accept a large number of characters passed in via a variable using -v.
The problem is, awk on HP-UX 11 doesn't seem to be able to handle the same amout of characters, does anybody know of a version of HP-UX awk that does. We are totally stuck as we don't actually have a HP-UX box here to try this out.

Any comments/help would be very greatly appreciated.
3 REPLIES 3
Leif Halvarsson_2
Honored Contributor

Re: Shell/Nawk/Compatibility

Hi
If I am correct nawk in Solaris is basically the same as awk in HP-UX but there can be some differences in implementation. For some years a "nawk" exist in HP-UX too together with the older awk. In later versions of HP-UX nawk replaced awk but Sun has for some reasons keep both.

I can,t find any dokumentation about max length for variables either in HP-UX awk or in Solaris nawk, only that there can be differences.

How long variables do you pass, can you perhaps give a example. I think it is possible to find a workaround.



Mark Stewart_2
New Member

Re: Shell/Nawk/Compatibility

I am using this for CGI, and the data being passed comes from quite a complex html page, the cgi string is in the region of 400 characters. I would pipe this information in but There is data being piped in as well from sqlplus.
A. Clay Stephenson
Acclaimed Contributor

Re: Shell/Nawk/Compatibility

Probably your best bet is to use the Gnu version of awk (gawk) on all platforms. In general, HP's awk is nawk but there may be some platform differences. If you go with gawk on all platforms those differences will disappear. Gawk is actually a superset of awk (and nawk) and many other limits like 3,000 characters per record (line) not become unlimited.

Here is a source for gawk:
http://hpux.cs.utah.edu/hppd/hpux/Gnu/gawk-3.1.1/

The other difference is that /usr/bin/sh on HP-UX in not Bourne but rather the POSIX sh which except fog very minior differences is the Korn sh. I've never found problems running ksh scripts under the POSIX shell but you can use ksh on HP-UX as well.
If it ain't broke, I can fix that.