Accessing *both* stdin and stdout of an external command: possible? 
Author Message
 Accessing *both* stdin and stdout of an external command: possible?

When I run an external command from within an awk program, is it
possible to programatically access both stdin *and* stdout of that
process?  For instance, is it possible for the awk program to generate
a bunch of lines, pipe them into "sort", then do some more processing
on sort's output (without storing the output from "sort" into a temp
file)?  I suspect this isn't possible, but I thought it couldn't hurt
to ask...

I'm using nawk on Solaris if that matters.

Thanks a lot!

Rich Simoni
--
Free audio & video emails, greeting cards and forums
Talkway - http://www.*-*-*.com/ - Talk more ways (sm)



Sun, 07 Jul 2002 03:00:00 GMT  
 Accessing *both* stdin and stdout of an external command: possible?

Quote:

> When I run an external command from within an awk program, is it
> possible to programatically access both stdin *and* stdout of that
> process?

With standard awk this is not possible. But it will be a feature
of the upcoming GNU AWK 3.1. I used this technique in an GAWK script
for abusing GNUPLOT as an "online image generator". GNUPLOT commands
are written into standard input of GNUPLOT and the resulting GIF
image comes out of standard output. You can find the example here:

  http://home.t-online.de/home/Juergen.Kahrs/inet.html#SEC22

This kind of "bidirectional pipe" was originally introduced into
GAWK 3.1 as a means of implementing network access. Therefore, the
example above is mainly about implementing a web service; the
subordinate GNUPLOT mechanism is just a way of producing images.

________________________________________________________________________

Juergen Kahrs                                       Tel.  0421  249 666
Millstaetter Strasse 15                             Tel.  0421  457 2819
D 28359 Bremen                                      Fax   0421  457 3578
____________ http://home.t-online.de/home/Juergen.Kahrs/ _______________



Sun, 07 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Capturing Stdin/Stdout while calling external programs?

2. redirect stdin/stdout of background command to/from a socket

3. Stdin/stdout with command pipeline channel?

4. use of spawn-access the results of an external command

5. JSPARC - STDIN/STDOUT?

6. stdout & stdin

7. Library to Allow 16-bit Clipper apps CGI, stdin-stdout

8. Question about I/O, stdin, stdout, in object rexx

9. Using rexx to drive stdin/stdout applications on OS/2

10. Help Request: how to redirect stdin e stdout?

11. stdout/stdin in DOS

12. MF Cobol and StdIN e StdOUT

 

 
Powered by phpBB® Forum Software