M
Markus Liebelt
Hello everybody,
I would like to build some small ruby programs, that will work
together as the unix shell commands. Eg the following could be used
inside a Cygwin shell:
$ ruby evallog.rb | ruby sum.rb "Log: (.*)"
which will evaluate a logfile, dump the result in lines, and the
second program will sum up the entries beginning with "Log: ". Just
to give you a sample how to do it.
I now try to combine the two little programs in one program without
redefining the way their methods work. The first just writes out its
result by "puts ...", the second uses the variable $stdin. But how
could a new method look that combines the two? I have no idea how to
write it down. Is there something to "fork" the first one, so that
the second one can read from standard input while the first writes to
standard output?
Thank you very much for your patience ...
I would like to build some small ruby programs, that will work
together as the unix shell commands. Eg the following could be used
inside a Cygwin shell:
$ ruby evallog.rb | ruby sum.rb "Log: (.*)"
which will evaluate a logfile, dump the result in lines, and the
second program will sum up the entries beginning with "Log: ". Just
to give you a sample how to do it.
I now try to combine the two little programs in one program without
redefining the way their methods work. The first just writes out its
result by "puts ...", the second uses the variable $stdin. But how
could a new method look that combines the two? I have no idea how to
write it down. Is there something to "fork" the first one, so that
the second one can read from standard input while the first writes to
standard output?
Thank you very much for your patience ...