In-line performance improved NAWK

In-line performance improved NAWK

Post by Dave Kra » Thu, 06 Jan 1994 05:54:46



I work on a UNIX based fault management application which matches incoming
messages against a knowledge base to determine corrective actions to be
taken. Currently, matching is done by piping messages to a NAWK process,
therefore pattern matching knowledge is kept in NAWK format. We have found
this implementation to be wanting because:

        1. Interprocess communication has big performance impact.

        2. There is a limit to the size of a NAWK script
        (knowledge:~2000 rules) that can be loaded into a NAWK process.

        3. Attempting to match each message serially to every NAWK rule
        can be time consuming.

        4. Regular expression matching has the side affect of creating
        very large memory size processes.

Recently, we have been looking into a Prolog implementation of a NAWK
pattern matcher, but I have concerns about some of the licensing
issues.

Anyway, I am interested in getting my hands on a NAWK pattern
matcher that I can invoke in-line, and that has the capability to improve
on straight serial message-to-rule matching by providing some sort
of binary nawk-rule search capabilities. Also, a more efficient regular
expression memory allocation scheme would be nice.

If you know of a pattern matcher like this, drop me a line.


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

(619) 485-2504                                    |
---------------------------------------------------

 
 
 

1. two simple nawk questions, Sunos 4.1.2 and nawk

I am trying to nawk through a file and change in the 20th field the value
of the date from mo/da/year, as in 02/30/1993, to mo/ld/year, as in
02/28/1993( where da is any particular day, even wrong ones, and ld is the
correct last day of the month), and the two problems I can't solve are,
that I can't get the shell wrapper to work like I would like without having
to specify a file on the command line, and I am having trouble finding a
way to print out the line when I am done, using ranges, like $1-$19.

I would like to do:

1)
#! /bin/nawk -f # Call the nawk script without any parameters
BEGIN { FS = "|";
       OFS = "|" }
{ while ( getline <"Data.file" > 0 )

...rest of script...

How can I run this program without having to use:

mysys: ~ $ datefix Data.file

In otherwords, just by typing the script name( without Data.file).

2)
How do I specify a range for a print statement:

print $1-$19,date,$21-$37

Right now it seems I have to have a line like:

print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14...goes on and on till
I wanna scream!

I am sorry if these are obvious questions or FAQ's, but nothing about them
appears in the O'Rielly book, or anywhere else.  I guess the creaters of
nawk expect you to write filters like:

mysys: ~ $ datefix -F\| -f20 < Data.file > Data.file.fixed

but I want to do it my way.
--



{...}!cs.utexas!cactus.org!cheselka (512)452-9412v ( 24hours answer. mach.)

2. HOW MUCH IS PURIFY ?

3. In-line assembly on c sources.

4. Help with Adaptec AHA-1542C

5. Writing in-line assembler in C

6. X-Server for DIAMOND...

7. Protecting in-line graphics??

8. diald 0.6 vs 0.7

9. Daemon Children: in-line code or execve?

10. Preventing In-line image linking

11. EOLs and Extra Blnaks removed in KSH for in-line commands

12. How can I remove in-line comment?

13. sending files in-line through a telnet session