Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!adm!amsaa-cleo!randy From: randy@amsaa-cleo.brl.mil (Randy Sebra ) Newsgroups: comp.unix.questions Subject: AWK system and close functions Message-ID: <308@amsaa-cleo.brl.mil> Date: 25 Nov 90 22:21:27 GMT Organization: Army Materiel Systems Analysis Activity Lines: 37 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