Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.misc Subject: Re: awk Message-ID: <1991Apr10.181844.2649@convex.com> Date: 10 Apr 91 18:18:44 GMT References: <1182@junkyard.UUCP> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 21 Nntp-Posting-Host: pixel.convex.com From the keyboard of hal@junkyard.UUCP (Hal Moroff): : : I'm trying to use awk to read an ascii file, and translate only :certain fields. I have my own special filter that will be used for the :translation. This is the old double-headed popen() problem. Your best bet is to write it all to a temp file, then read from the file when done. This is the best way to avoid deadlock. You could theoretically use some forks, dups, and execs do get this all right, but unless you are sure of the behavior of the inferior, you can't guarantee that you'll be free of deadlock. Of course, awk won't let you do these things, nor could you flush the pipe if you wanted to. You might look at question 20 of the Frequently Asked Questions list in comp.lang.perl -- perl code is included there for doing this, and the algorithm is easily translatable into C. But awk users are at a dead-end. --tom