shell question

mrspock at esfm.ipn.mx mrspock at esfm.ipn.mx
Tue Apr 5 09:33:29 PDT 2005


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.




More information about the freebsd-questions mailing list