Sorry for another OT post here, but this is the best place I've found
for linux knowledge even when not debian specific.

I am trying to write a short awk script to process my /etc/services file
into a format that the utilities supplied with yp/nis can correctly
handle. What I need to do is to parse off the service name and
portnumber/protocol, and the following comments, and rewrite these
fields out in a different format. My script does the parsing correctly,
but after processing about 991 lines, it fails saying:
'awk: program limit exceeded: maximum number of fields size=32767
        FILENAME="-" FNR=991 NR=991'

I don't know why this would occur - it would seem that the field count
should reset with each line read, and the line that follows the last
processed line is not different in format that any preceeding line, so I
cannot figure out why this fails. I'm obviously not an awk expert, but
still... Note that the script is written to exclude lines with an email
address in them (finds "@") and lines with the string "--none---"
because these are comment lines which I don't need and nis will not need
anyway...but other comment lines (starting with "#") are kept for
readability and just output without the parsing.


Here's the command I am running:

cat /etc/services | \
        awk '{ if (index($0,"@") == 0 && index($0,"--none---") == 0) { \
                if substr($0,1,1) == "#") print $0;             \
                else {                                          \
                        TMP = $1"\t\t"$2"\t\t#";                \
                        for (i = 3; i <= NF; i++) TMP = $TMP $i; \
                        print $TMP;                             \
                }                                               \
                }                                               \
        }'

Thanks for any suggestions.

nl




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to