Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!CSUFRES.CSUFRESNO.EDU!quang From: quang@CSUFRES.CSUFRESNO.EDU (Quang Ngo) Newsgroups: comp.unix.questions Subject: System() call in nawk Message-ID: <9105151629.AA08499@csufres.CSUFresno.EDU> Date: 15 May 91 16:29:34 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 35 I have a question about nawk. Why does the command 'system' know id but not f[i]? It says nawk: f[i]: No such file ..... However, if I change it to if (system("grep id 1fl_87.txt") == 1) then it works okay. Thank you, -Quang (quang@csufres.CSUFresno.EDU) -------------------------- BEGIN { f[0] = "1fl_87.txt" f[1] = "2sp_88.txt" f[2] = "3fl_88.txt" f[3] = "4sp_89.txt" f[4] = "5fl_89.txt" f[5] = "6-SP90" } { id = substr($0,34,9) for (i=0; i<6; i++) if (system("grep id f[i]") == 1) printf("%s %d\n",id,i) } --------------------------