AWK system and close functions
Randy Sebra <randy>
randy at amsaa-cleo.brl.mil
Mon Nov 26 09:21:27 AEST 1990
Hello,
I have tried unsuccessfully to use the 'system' and 'close'
functions in an AWK script. I have tried this on a Gould 9080, Pyramid
MIS-4, and an Alliant FX/8 on their ports of UNIX. None seems to give
the results I would expect from reading the book "The AWK Programming
Language" by A,W,and K. The following examples :
awk '{ system("ls -lg /etc") }' /dev/null
awk '{ system("ls -lg /etc > /tmp/list") }' /dev/null
are simple one-liners which produce no output/results, and the function
does not work any better in a more complicated script. Also surprising
is that even though nothing is accomplished in either, I do not get an
error message which would indicate that at least the syntax is correct.
Similarily, the close() function does not(apparently) do anything
as per this example :
print $0 > "foofile"
...
close("foofile")
which was used in order to keep under the limit of 10 open files, but
the program still bombs with the message :
awk: too many output files 10
record number 11
I am I missing something really elemental here??
Randy Sebra
Army Materiel Systems Analysis Activity
Attn: AMXSY-DA
Aberdeen Proving Ground, Maryland 21005-5071
Phone: (301) 278-6679 (AV) 298-6679
More information about the Comp.unix.questions
mailing list