mrspock at esfm dot ipn dot mx wrote:
standard
PostScript.
"filter"
program < stdin 3>&1 1>&2 2>&3 | a2ps
Regards Björn
Hello FreeBSD gurus! I address you in hope of enlightment. Here is the problem: I have a program that creates a PostScript output and writes it to its standard output. This program also writes diagnostic messages to the standard error output at the same time, in this case the messages are written in plain text. I need to concatenate the standard output and then standard error output in a file, but I need to convert the standard output into PostScript before the concatenation. program <stdin >stdout 2> stderr cat stdout > out a2ps stdout >> out a2ps is in the ...
Hello FreeBSD gurus!
I address you in hope of enlightment.
Here is the problem:
I have a program that creates a PostScript output
and writes it to its standard output.
This program also writes diagnostic messages to
the standard error output at the same time, in
this case the messages are written in plain text.
I need to concatenate the standard output and
then standard error output in a file, but I need
to convert the standard output into PostScript
before the concatenation.
program <stdin >stdout 2> stderr
cat stdout > out
a2ps stdout >> out
a2ps is in the ports and it converts plain text
into PostScript.
The problem is that I don't want to use the temporary
file that I used above (stdout, stderr, out), I just
want a "filter"
In a diagram, it can be seen as:
stdin ==> program ==> [stdout, a2ps(stderr)]
I have tried:
cat stdin | program 2> tmp | ( cat && a2ps tmp )
but I still need a temporary file.
Can it be done?
Can you help me and tell me how ?
Thanks in advance.
-Eduardo.
PS. Please, answer to my e-mail address, I am not
subscribed to the list.
mrspock at esfm dot ipn dot mx wrote:
standard
PostScript.
"filter"
program < stdin 3>&1 1>&2 2>&3 | a2ps
Regards Björn
[/ref]
You meant
program <stdin >stdout 2> stderr
cat stdout > out
a2ps **stderr** >> out
Don't you?
On Tue, 5 Apr 2005, Björn König wrote:
[/ref]
>
> You meant
>
> program <stdin >stdout 2> stderr
> cat stdout > out
> a2ps **stderr** >> out
>
> Don't you?
>[/ref]
yes! sorry!
In article <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 org.uk _O_
|<
On Tue, 5 Apr 2005, Björn König wrote:
> standard
>
> PostScript.
>
> "filter"
>
> program < stdin 3>&1 1>&2 2>&3 | a2ps
>
> Regards Björn
>[/ref]
Thanks for your help, Björn.
I think I'd better study a little more this redirection operators.
Thanks again.
Eduardo.
On Wed, 6 Apr 2005, Richard Caley wrote:
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 doent 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.
Bookmarks