From owner-freebsd-questions@FreeBSD.ORG Wed Apr 6 18:40:19 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78FF716A515 for ; Wed, 6 Apr 2005 18:40:19 +0000 (GMT) Received: from Gina.esfm.ipn.mx (esfm.ipn.mx [148.204.102.61]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FB3743D53 for ; Wed, 6 Apr 2005 18:40:17 +0000 (GMT) (envelope-from mrspock@esfm.ipn.mx) Received: from Gina.esfm.ipn.mx (localhost.esfm.ipn.mx [127.0.0.1]) by Gina.esfm.ipn.mx (8.13.1/8.13.1) with ESMTP id j36IcVGD035192; Wed, 6 Apr 2005 13:38:31 -0500 (CDT) (envelope-from mrspock@esfm.ipn.mx) Received: from localhost (mrspock@localhost)j36IcVbr035189; Wed, 6 Apr 2005 13:38:31 -0500 (CDT) (envelope-from mrspock@esfm.ipn.mx) X-Authentication-Warning: Gina.esfm.ipn.mx: mrspock owned process doing -bs Date: Wed, 6 Apr 2005 13:38:31 -0500 (CDT) From: Eduardo Viruena Silva To: Richard Caley In-Reply-To: <87ekdo2vnc.fsf@pele.r.caley.org.uk> Message-ID: <20050406100221.M16224@Gina.esfm.ipn.mx> References: <63501.201.135.130.41.1112718721.squirrel@201.135.130.41> <87ekdo2vnc.fsf@pele.r.caley.org.uk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org Subject: Re: shell question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2005 18:40:19 -0000 On Wed, 6 Apr 2005, Richard Caley wrote: > In article <63501.201.135.130.41.1112718721.squirrel@201.135.130.41>, mrspock (m) writes: > > m> The problem is that I don't want to use the temporary > m> file that I used above (stdout, stderr, out), I just > m> want a "filter" > > If you want to rearange the output so that all the errors are after > all the non errors, then you are going to need storage of some sort. I > think that is logically unavoidable. > > There may be some kind of shuffle you can do with named pipes or > something, but those kind of things have limited storage. Any time > your command produces more error output than that space can hold, it > will be stopped. Since you are not reading that stream until the main > output is finished you'd then have a deadlock. > > -- > Mail me as MYFIRSTNAME@MYLASTNAME.org.uk _O_ > |< Thank you, Richard. Efectively, I found that is easier to create a temporary file with one of the output files, in this case "stderr". Stderr is used, in this case to create a listing of the data that the program is using and, occasionally, it issues an error message, in this case the program stops. I finally programmed this process in this way: program 2> tempfile | (cat && a2sp tempfile) | ps2pdf As I already stated, my program is creating a PostScript output in its stdout and a "listing" in the stderr file. a2ps is converting this listing to PostScript and both of them, finally, are converted to a PDF document with GhostScripts [in the ports]. Finally, the name "pipes" is very precise to describe what is happening with the "streams"; obviously, if I want to process one of the streams after the other one, I need to contain the "water" of the second temporally. Thanks for your time and your help. Eduardo. PS. Perhaps you are interested in visiting my page: http://michelle.esfm.ipn.mx/~mrspock/superspiro Cut & Paste one of the examples and execute the program at the end of the page.