For Programmers: Free Programming Magazines  


Home > Archive > AWK > March 2006 > which gawk to gawk co-process or service?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author which gawk to gawk co-process or service?
Grant

2006-02-10, 9:55 pm

Hi there,

I'm writing a small gawk application that uses a 70k+ line lookup
file. To save database loading time I'm looking at running the
database as a service or co-process.

Can someone confirm that an /inet/ service is the right way to go
as I don't want to start a child co-process, I want to query an
already running co-process that has loaded the database.

Things to watch out for?

Thanks,
Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Joe User

2006-02-11, 3:55 am

On Sat, 11 Feb 2006 12:13:46 +1100, Grant wrote:

> Hi there,
>
> I'm writing a small gawk application that uses a 70k+ line lookup file.
> To save database loading time I'm looking at running the database as a
> service or co-process.
>
> Can someone confirm that an /inet/ service is the right way to go as I
> don't want to start a child co-process, I want to query an already running
> co-process that has loaded the database.


I would probably create two FIFO's. One for requests, the other for
responses. But it is probably overkill. Why not just search a file?
Once the whole thing is loaded in buffered in memory, file accesses are
very fast. Try to search without regular expressions, though.

--
USA Today has come out with a new survey: Apparently three
out of four people make up 75 percent of the population.

-- David Letterman

Grant

2006-02-11, 3:55 am

On Sat, 11 Feb 2006 02:44:53 -0600, Joe User <axyz@yahoo.com> wrote:

>On Sat, 11 Feb 2006 12:13:46 +1100, Grant wrote:
>
>
>I would probably create two FIFO's. One for requests, the other for
>responses. But it is probably overkill. Why not just search a file?


Because it takes many seconds to load, that's why I wanted to try a server.

>Once the whole thing is loaded in buffered in memory, file accesses are
>very fast. Try to search without regular expressions, though.


I'm doing a binary search over the database in memory, no problem
there as the thing is only three fields / record.

Since writing the above query I've got a client / server running.

Problem with "|&" is synchronising for fast performance, starting
from the 'info gawkinet' I wrote the server and a test client, but
they fall apart on high load --> a single call works, but put that
call in a for loop and I get lockups... If I start putting in a
sync protocol I'll lose performance, may as well suffer the data
loading time instead and keep existing method.

Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Grant

2006-02-11, 3:55 am

On Sat, 11 Feb 2006 20:31:56 +1100, Grant <bugsplatter@gmail.com> wrote:

>Since writing the above query I've got a client / server running.


On a pentium/233 I get service time of 3.8ms / lookup with UDP
over a thousand tries.

I'll need to benchmark the application with / without the server.

Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
John DuBois

2006-02-11, 6:55 pm

In article <nabru15s9ngjivbd9g9o4sf9vi6j4jvrl7@4ax.com>,
Grant <bugsplatter@gmail.com> wrote:
>On Sat, 11 Feb 2006 02:44:53 -0600, Joe User <axyz@yahoo.com> wrote:

....
>Because it takes many seconds to load, that's why I wanted to try a server.
>
>
>I'm doing a binary search over the database in memory, no problem
>there as the thing is only three fields / record.


If your client/server method doesn't work out, and if you can arrange your
database so that the binary search is to be performed according to the lexical
value of the first field, you might want to try 'look'. It reads only those
blocks of a file neccessary for a binary search. For large database files it
is so much faster than reading the whole file that it can be well worth calling
it from an awk program. Of course, if you need to do multiple queries from a
single instance of a client, the benefit is rapidly lost.

John
--
John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
Grant

2006-02-11, 6:55 pm

Hi John,
On Sat, 11 Feb 2006 15:49:04 -0000, spcecdt@armory.com (John DuBois) wrote:

>If your client/server method doesn't work out, and if you can arrange your
>database so that the binary search is to be performed according to the lexical
>value of the first field, you might want to try 'look'.


Yes, the search is against first field. Now I learn another old
unix command. I'll try it. Reinventing the wheel is such fun ;)

Thanks,
Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Grant

2006-02-11, 9:55 pm

On Sat, 11 Feb 2006 15:49:04 -0000, spcecdt@armory.com (John DuBois) wrote:

>If your client/server method ...


'look' no good for this as I need 'closest less than' result from
data table (I'm looking up which IP block an address belongs to).

Had a win, timing as client to lookup service, then as standalone:

root@deltree:~# time zcat /var/log/messages.1.gz | /usr/local/bin/junkview \
-v hours=0 netmin=24 netmax=28 hits=2 drop=0 showhits=10 debug=0 quiet=0 client=1
junkview v. 2006-02-11...
....
Reviewed 3624 records and examined 3624 to find 2105 events from deltree.
Settings: hours=0, prefix=InpDrop, bars=16, hits=2, netmin=24, netmax=28.
Reading: /home/share/junk/ip2country-names, success.

Top 10 hits by host:
hits host address lookup netaddr code country
----- --------------- ------------------ -- ----------------------
43 204.16.208.67 204.16.208.0/22 US United States
37 220.240.114.185 220.240.0.0/16 AU Australia
32 220.240.8.132 220.240.0.0/16 AU Australia
28 60.11.125.39 60.11.0.0/16 CN China
28 207.46.98.43 207.46.0.0/16 US United States
23 220.240.112.185 220.240.0.0/16 AU Australia
22 222.141.69.129 222.136.0.0/13 CN China
21 220.240.158.88 220.240.0.0/16 AU Australia
21 219.146.161.10 219.144.0.0/13 CN China
20 61.132.254.60 61.132.0.0/16 CN China

Top 10 hits by net:
hits lookup netaddr net address code country
----- ------------------ ------------------ -- ----------------------
295 220.240.0.0/16 220.240.0.0/16 AU Australia
105 221.14.0.0/15 221.14.246.224/27 CN China
70 68.142.192.0/18 68.142.248.0/22 US United States
59 66.249.64.0/19 66.249.64.0/21 US United States
48 60.11.0.0/16 60.11.125.36/30 CN China
43 204.16.208.0/22 204.16.208.67/32 US United States
40 207.46.0.0/16 207.46.98.42/31 US United States
36 222.136.0.0/13 222.136.0.0/13 CN China
32 220.239.0.0/16 220.239.0.0/16 AU Australia
32 219.144.0.0/13 219.146.0.0/15 CN China

real 0m2.696s
user 0m1.720s
sys 0m0.120s
root@deltree:~# time zcat /var/log/messages.1.gz | /usr/local/bin/junkview \
-v hours=0 netmin=24 netmax=28 hits=2 drop=0 showhits=10 debug=0 quiet=0 client=0
junkview v. 2006-02-11...
....
Reviewed 3624 records and examined 3624 to find 2105 events from deltree.
Settings: hours=0, prefix=InpDrop, bars=16, hits=2, netmin=24, netmax=28.
Reading: /home/share/junk/ip2country..................... 71491 records.
Reading: /home/share/junk/ip2country-names, success.

Top 10 hits by host:
hits host address lookup netaddr code country
----- --------------- ------------------ -- ----------------------
43 204.16.208.67 204.16.208.0/22 US United States
37 220.240.114.185 220.240.0.0/16 AU Australia
32 220.240.8.132 220.240.0.0/16 AU Australia
28 60.11.125.39 60.11.0.0/16 CN China
28 207.46.98.43 207.46.0.0/16 US United States
23 220.240.112.185 220.240.0.0/16 AU Australia
22 222.141.69.129 222.136.0.0/13 CN China
21 220.240.158.88 220.240.0.0/16 AU Australia
21 219.146.161.10 219.144.0.0/13 CN China
20 61.132.254.60 61.132.0.0/16 CN China

Top 10 hits by net:
hits lookup netaddr net address code country
----- ------------------ ------------------ -- ----------------------
295 220.240.0.0/16 220.240.0.0/16 AU Australia
105 221.14.0.0/15 221.14.246.224/27 CN China
70 68.142.192.0/18 68.142.248.0/22 US United States
59 66.249.64.0/19 66.249.64.0/21 US United States
48 60.11.0.0/16 60.11.125.36/30 CN China
43 204.16.208.0/22 204.16.208.67/32 US United States
40 207.46.0.0/16 207.46.98.42/31 US United States
36 222.136.0.0/13 222.136.0.0/13 CN China
32 220.239.0.0/16 220.239.0.0/16 AU Australia
32 219.144.0.0/13 219.146.0.0/15 CN China

real 0m6.274s
user 0m5.730s
sys 0m0.300s

The client/server is about 1 second faster on UDP but unreliable
(Doh!), to prevent 'broken pipe' error with TCP I had to detect
duplicate queries and close connection. The client doesn't send
dup queries. performing on a pentium classic 233 ;)
http://bugsplatter.mine.nu/test/boxen/deltree/

server startup and main loop for the terminally curious:

BEGIN {
if (!port) port = 7300
ip2c_server = "/inet/tcp/" port "/0/0"
if (!datapath) datapath = "/home/share/junk/"
if (!datafile) datafile = (datapath "ip2country")
read_ip2country()
oldquery = query = "xyz"
for (;;) {
seq = ++seq % 100000
printf "%05d ", seq
ip2c_server |& getline query
if (oldquery == query) {
close(ip2c_server)
continue
}
oldquery = query
printf "%s -> ", query
split(query, k, ".")
addr = 0
for (j = 1; j <= 4; j++) { # convert to binary addr
addr *= 256
addr += and(k[j], 255)
}
result = search_ip2country(addr)
print result |& ip2c_server
print result
}
}

client lookup:
....
ip2c_server = "/inet/tcp/0/localhost/7300"
....
function search_ip2country(a, i, j, k, m, n, o)
{
if (!!client) {
print a |& ip2c_server
if (debug > 1) printf "%20s ", a
ip2c_server |& getline o
if (debug > 1) print o
return o
}
....

more (for context) at:
http://bugsplatter.mine.nu/bash/junk/junkdata.html

Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Joel Reicher

2006-02-21, 7:55 am

Grant <bugsplatter@gmail.com> writes:

> I'm writing a small gawk application that uses a 70k+ line lookup
> file. To save database loading time I'm looking at running the
> database as a service or co-process.
>
> Can someone confirm that an /inet/ service is the right way to go
> as I don't want to start a child co-process, I want to query an
> already running co-process that has loaded the database.


Unless the coprocess is running on a remote machine, there's no reason
to use a net protocol at all. Put a pair of FIFOs in the filesystem
with mkfifo and use them á la pty/tty pairs.

Of course, I could have misunderstood what you're trying to do...

Cheers,

- Joel
Joel Reicher

2006-02-21, 7:55 am

Joel Reicher <joel@panacea.null.org> writes:

> with mkfifo and use them á la pty/tty pairs.


Sorry. Grave, not acute.

*grumble*

- Joel
Grant

2006-02-21, 9:55 pm

On Tue, 21 Feb 2006 12:20:11 GMT, Joel Reicher <joel@panacea.null.org> wrote:

>Grant <bugsplatter@gmail.com> writes:
>
....[color=darkred]
>Unless the coprocess is running on a remote machine, there's no reason
>to use a net protocol at all.


I have /inet/ client server running, but have had to take some guessed
at evasive action to keep the thing up -- avoiding 'broken pipe' and
server / client lockup when several dozen or hundred queries performed
in a loop. UDP didn't go very well at all, I thought it might on same
box?

server main loop (current version):
BEGIN {
if (!port) port = 7300
ip2c_server = "/inet/tcp/" port "/0/0"
if (!datapath) datapath = "/home/share/junk/"
if (!datafile) datafile = (datapath "ip2country")
read_ip2country()

oldquery = query = "xyz"
for (;;) {
seq = ++seq % 100000
printf "%05d", seq
ip2c_server |& getline query
if (oldquery == query) { # avoids broken pipe
print "!"
close(ip2c_server)
oldquery = query = "xyz"
continue
}
oldquery = query
printf "%17s", query
if (query == "shutdown")
break
result = search_ip2country(query)
print result |& ip2c_server
fflush(ip2c_server)
printf "%20s\n", result
}
close(ip2c_server); exit 0
}
....
(See http://bugsplatter.mine.nu/junk/ip2country-server for context)

client is easier:
#!/bin/bash
#
awk -v addr=$1 'BEGIN {
server = "/inet/tcp/0/localhost/7300"
if (!addr) addr = 0.0.0.0
print addr |& server
server |& getline
print $0
}'

Or from an awk program:
....
if (!port) port = 7300
ip2c_server = "/inet/tcp/0/localhost/" port
....
# cache avoids duplicate lookups
if (ip2c_cache[a]) return ip2c_cache[a]
if (client) { # perhaps use optional server
print a |& ip2c_server
fflush(ip2c_server)
ip2c_server |& getline ip2c_cache[a]
return ip2c_cache[a]
}
....
(See http://bugsplatter.mine.nu/junk/junkview-2006-02-21c.gz for context)

> Put a pair of FIFOs in the filesystem
>with mkfifo and use them á la pty/tty pairs.


Never used FIFOs... Can they connect to a running service rather than
a child process?

>Of course, I could have misunderstood what you're trying to do...


What I'm trying to do is eliminate load time for database table
with >70k records for each run of a filter program by having a
server already running to answers queries (simple lookup with
binary search) against the database.

My reading of co-processes in awk led me to think that no other
method will achieve this because awk starts co-process as a child on
first access with "|&". I could be wrong here?

Thanks,
Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Joel Reicher

2006-02-21, 9:55 pm

Grant <bugsplatter@gmail.com> writes:

> On Tue, 21 Feb 2006 12:20:11 GMT, Joel Reicher <joel@panacea.null.org> wrote:
>
> ...
>
> I have /inet/ client server running, but have had to take some guessed


(code snipped)

Sorry, but I'm not going to check through the code until you confirm
that the server needs to run remotely. If it's running locally,
there's just no point complicating matters so much.

>
> Never used FIFOs... Can they connect to a running service rather than
> a child process?


You should read the man page for mkfifo. It creates a "file" (entry)
in the filesystem that can be written to and read from, but which is
just a FIFO (or bounded buffer, or queue, or pipe, or whatever you
want to call it). The FIFO doesn't do anything on its own. You can
code your server to read from the FIFO your client is writing to, and
vice versa for the second FIFO. The existence of the FIFOs is
independent of any instance of the client or server. The client and
server only need to get the "file"names right.

>
> What I'm trying to do is eliminate load time for database table
> with >70k records for each run of a filter program by having a
> server already running to answers queries (simple lookup with
> binary search) against the database.


And if the server and client are on the same machine, you can use
FIFOs in the filesystem. That's *very* easy.

> My reading of co-processes in awk led me to think that no other
> method will achieve this because awk starts co-process as a child on
> first access with "|&". I could be wrong here?


No, you're right about awk, but then "|&" is not the only way to use a
coprocess. It's not even a good way, IMHO. Start up the two processes
independently of each other, and use FIFOs in the filesystem (if this
stuff is local).

Cheers,

- Joel
Grant

2006-02-22, 3:55 am

On Wed, 22 Feb 2006 03:38:16 GMT, Joel Reicher <joel@panacea.null.org> wrote:

>Sorry, but I'm not going to check through the code until you confirm
>that the server needs to run remotely. If it's running locally,
>there's just no point complicating matters so much.


Yes, running locally, no requirement for remote.

.. . . Hey, it works! :) Haven't translated the main client

Like this?
/home/share/junk:
prw-rw---- 1 grant wheel 0 2006-02-22 17:21 query|
prw-rw---- 1 grant wheel 0 2006-02-22 17:21 result|

server (gawk program, main loop):

BEGIN {
if (!datapath) datapath = "/home/share/junk/"
if (!datafile) datafile = (datapath "ip2country")
read_ip2country()
np_query = (datapath "query")
np_result = (datapath "result")
close(np_query, "to")
close(np_result, "from")

for (;;) {
seq = ++seq % 100000
printf "%05d", seq
getline query < np_query
close(np_query, "from")
printf "%17s", query
if (query == "shutdown")
break
result = search_ip2country(query)
print result > np_result
close(np_result, "to")
printf "%20s\n", result
}
close(np_query)
close(np_result)
exit 0
}

oneshot test client (bash):

awk -v addr=$1 'BEGIN {
datapath = "/home/share/junk/"
np_query = (datapath "query")
np_result = (datapath "result")
close(np_query, "from")
close(np_result, "to")

if (!addr) addr = 0.0.0.0
print addr > np_query
close(np_query)
getline result < np_result
close(np_result)
print result
}'

Thanks,
Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Joel Reicher

2006-02-22, 7:55 am

Grant <bugsplatter@gmail.com> writes:

> Like this?
> /home/share/junk:
> prw-rw---- 1 grant wheel 0 2006-02-22 17:21 query|
> prw-rw---- 1 grant wheel 0 2006-02-22 17:21 result|


Yep.

> close(np_query, "to")
> close(np_result, "from")


You don't need the second argument to your close calls now that you're
using normal awk IO.

Glad it seems to be working.

Cheers,

- Joel
Loki Harfagr

2006-02-22, 7:55 am

Le Sat, 11 Feb 2006 20:31:56 +1100, Grant a écrit_:

(I snipped a lot because it's only a partial suggestion on an already
OT to awk threading ;-)

>
> Because it takes many seconds to load, that's why I wanted to try a server.


I'd also globally recommend the fifos, but in case your file can hold
in the RAM why not mounting a partition in shared memory and copy
your file in this partition (I guess you're on Linux-Slackware ?-)

Sorry gentlemen, end of intermission :-)
Grant

2006-02-22, 7:55 am

On Wed, 22 Feb 2006 11:50:31 GMT, Joel Reicher <joel@panacea.null.org> wrote:

>Grant <bugsplatter@gmail.com> writes:
>
>
>Yep.
>
>
>You don't need the second argument to your close calls now that you're
>using normal awk IO.


Yep, found that when I was rewriting the code for the 'real' one ;)
Thanks,
Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Grant

2006-02-22, 7:55 am

On Wed, 22 Feb 2006 13:00:21 +0100, Loki Harfagr <loki@DarkDesign.free.fr> wrote:

> I'd also globally recommend the fifos, but in case your file can hold
>in the RAM why not mounting a partition in shared memory and copy
>your file in this partition (I guess you're on Linux-Slackware ?-)


'cos I didn't think of that ;) Besides I want to stretch, learning
awk -- this little toy is what your Dalmatians and (dwarf) stars
turned into :o)

Cheers,
Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Grant

2006-02-22, 6:56 pm

On Wed, 22 Feb 2006 13:00:21 +0100, Loki Harfagr <loki@DarkDesign.free.fr> wrote:

> I'd also globally recommend the fifos, but in case your file can hold
>in the RAM why not mounting a partition in shared memory and copy
>your file in this partition (I guess you're on Linux-Slackware ?-)


Benchmarked normal (on disk) filesystem vs tmpfs vs client / server:

normal standalone 6.2s
tmpfs standalone 6.06s
client / server (FIFO) 2.27s

Grant.
--
.... The computer scientist, who had listened to all of this said,
"Yes, but where do you think the chaos came from?"
Loki Harfagr

2006-02-22, 6:56 pm

Le Thu, 23 Feb 2006 00:59:07 +1100, Grant a écrit_:

> On Wed, 22 Feb 2006 13:00:21 +0100, Loki Harfagr <loki@DarkDesign.free.fr> wrote:
>
>
> Benchmarked normal (on disk) filesystem vs tmpfs vs client / server:
>
> normal standalone 6.2s
> tmpfs standalone 6.06s
> client / server (FIFO) 2.27s
>
> Grant.


That's quite the reason why I also thought to fifo as a
best bet ;-)
It prolly implies that your file is not that huge for the
running system and then its caching in shared mem was here
all the time :-)
Now, I wouldn't pretend that your test was a real benchmarking of
this stuff, though I kind of like the idea a private joke on Disney and
one of my songs are alive thru abusenet*awk ;D)
giacomo_boffi@nospammmers.inwind.it

2006-03-09, 7:55 am

Grant <bugsplatter@gmail.com> writes:

> On Wed, 22 Feb 2006 11:50:31 GMT, Joel Reicher <joel@panacea.null.org> wrote:
>
>
> Yep, found that when I was rewriting the code for the 'real' one ;)


now that you're using normal awk IO, if you're still in search of full
speed... what about a faster awk than gawk?
Grant

2006-03-09, 6:55 pm

On Thu, 09 Mar 2006 13:13:17 +0100, giacomo_boffi@nospammmers.inwind.it wrote:

>Grant <bugsplatter@gmail.com> writes:
>

prw-rw---- 1 root wheel 0 2006-03-10 05:03 ip2c_query|
prw-rw---- 1 root wheel 0 2006-03-10 05:03 ip2c_reply|

for (;;) {
getline query < ip2c_query
close(ip2c_query, "from")
print search_ip2country(query) > ip2c_reply
close(ip2c_reply, "to")
}

One does need to use second argument with FIFOs for everything
to stay nice, on this GNU/Linux (Slackware-10.2 + updates) box.[color=darkred]
>
>now that you're using normal awk IO, if you're still in search of full
>speed... what about a faster awk than gawk?


What's faster? awka?

Grant.
--
Cats are smarter than dogs. You can't make eight cats pull
a sled through the snow.
John DuBois

2006-03-10, 6:55 pm

In article <t4t012l18fj0da8hs2fhiacqg973i5u0k5@4ax.com>,
Grant <bugsplatter@gmail.com> wrote:
>On Thu, 09 Mar 2006 13:13:17 +0100, giacomo_boffi@nospammmers.inwind.it wrote:
>
>What's faster? awka?


Yes. And, almost always, mawk (often twice as fast) - though it is long since
derelict, and keels over on so much of my code that I've gradually given up on
it, to the point where I have just one awk program that still uses it. Still
useful for stuff that doesn't exercise its bugs.

John
--
John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
Chris F.A. Johnson

2006-03-10, 6:55 pm

On 2006-03-10, John DuBois wrote:
> In article <t4t012l18fj0da8hs2fhiacqg973i5u0k5@4ax.com>,
> Grant <bugsplatter@gmail.com> wrote:
>
> Yes. And, almost always, mawk (often twice as fast) - though it is long since
> derelict, and keels over on so much of my code that I've gradually given up on
> it, to the point where I have just one awk program that still uses it. Still
> useful for stuff that doesn't exercise its bugs.


What are mawk's bugs?

I believe there are a few where it lacks POSIX compliance (but I
don't have any specifics). Are there any others?

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Jürgen Kahrs

2006-03-11, 6:56 pm

Chris F.A. Johnson wrote:

> What are mawk's bugs?
>
> I believe there are a few where it lacks POSIX compliance (but I
> don't have any specifics). Are there any others?


Read Arnold Robbins' Reference Card, which comes
with the GAWK distribution. All the subtle differences
are marked with colored text.

Read mawk's man page:

mawk cannot handle ascii NUL \0 in the source or data
files. You can output NUL using printf with %c, and any
other 8 bit character is acceptable input.

This is actually not a bug, since POSIX does not
require AWK to handle NUL characters. I dont think
the problems with mawk and POSIX are actually bugs.
The most recent version was released in the mid-90s.
So, mawk has simply stopped adapting to current
standards. Have you (Americans) noticed what happened
with i18n in GNU Awk ? Did you know that GNU Awk
supports localization for some time now. Did you
notice that the most recent version of GNU Awk can
handle multi-byte characters, which appear in Japanese
texts ?
John DuBois

2006-03-13, 3:55 am

In article <3md9e3-11e.ln1@xword.teksavvy.com>,
Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
> What are mawk's bugs?
>
> I believe there are a few where it lacks POSIX compliance (but I
> don't have any specifics). Are there any others?


Functions and variables (even local variables) can't have the same names.

You can't call next from a function.

Literal strings longer than 5120 characters produce a core dump.

It breaks on unresolved function names.

Some that also affect traditional awks, but not gawk:

Breaks on the pattern /[/]/

Breaks on >= in various places, e.g.: print 2 >= 1

Can't use nulls in strings

John
--
John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com