Discussion:
Regina-REXX/Linux: processing output from Linux Commands
(too old to reply)
Mike H
2005-04-01 18:44:06 UTC
Permalink
I'm using more and more REXX in my Linux work (must be a result of old
VM and OS/2 habits...). I frequently want to use Linux commands
and then process the output within the REXX 'environment'. For example, I do a
command, then grep the result and pipe the output (stdout) of grep
to ????? I've been redirecting the stdout to a file and then
reading the file into REXX variables. I'd really like to be able to
redirect the stdout directly into a stem variable, or something such...

Any suggestions?

Thanks
Mike
Mark V
2005-04-01 20:08:42 UTC
Permalink
Post by Mike H
I'm using more and more REXX in my Linux work (must be a result
of old VM and OS/2 habits...). I frequently want to use Linux
commands and then process the output within the REXX
'environment'. For example, I do a command, then grep the
result and pipe the output (stdout) of grep to ????? I've
been redirecting the stdout to a file and then reading the file
into REXX variables. I'd really like to be able to redirect
the stdout directly into a stem variable, or something such...
Generally, use a Rexx implementation that supports the ANSI ADDRESS
redirection "enhancements" I believe.

On Win32 Regina does this. Uncertain as regards the Linux version.

I use this capability all the time. In the Regina 3.3 documents see
2.4.1 The ADDRESS Instruction
for more.
Patrick TJ McPhee
2005-04-03 03:59:18 UTC
Permalink
In article <Bqh3e.19306$f%***@bignews1.bellsouth.net>,
Mike H <***@bellsouth.net> wrote:

% reading the file into REXX variables. I'd really like to be able to
% redirect the stdout directly into a stem variable, or something such...

You can use the address statement.
You can use the rxqueue program and the stack.
You can use my fileut package -- this allows you to run a command in
the background and read its output using an api reminiscent of the
standard stream commands. I also have a regular expression package
which would allow you to dispense with grep.

http://www.interlog.com/ptjm
--
Patrick TJ McPhee
North York Canada
***@interlog.com
Florian Große-Coosmann
2005-04-03 18:41:33 UTC
Permalink
Post by Mike H
I'm using more and more REXX in my Linux work (must be a result of old
VM and OS/2 habits...). I frequently want to use Linux commands
and then process the output within the REXX 'environment'. For example,
I do a command, then grep the result and pipe the output (stdout) of grep
to ????? I've been redirecting the stdout to a file and then
reading the file into REXX variables. I'd really like to be able to
redirect the stdout directly into a stem variable, or something such...
Any suggestions?
Others have explained the answer, so I just have to give an example:

ADDRESS PATH "ls" WITH OUTPUT STEM files.

The environment PATH needs a command with its own program.
The environment SYSTEM allows shell interaction like

ADDRESS SYSTEM "ls | fgrep '.jpg'" WITH OUTPUT STEM files.

PATH cannot be used here because the pipe symbol "|" isn't
interpreted by Regina. On the other hand PATH is faster then
SYSTEM.

Cheers, Florian
Mike H
2005-04-03 23:19:32 UTC
Permalink
I love examples, and that looks almost exactly like what
I want to do....
Thanks!!
(and thanks for the other replies also!)

Mike
Post by Florian Große-Coosmann
Post by Mike H
I'm using more and more REXX in my Linux work (must be a result of old
VM and OS/2 habits...). I frequently want to use Linux commands
and then process the output within the REXX 'environment'. For
example, I do a command, then grep the result and pipe the output
(stdout) of grep
to ????? I've been redirecting the stdout to a file and then
reading the file into REXX variables. I'd really like to be able to
redirect the stdout directly into a stem variable, or something such...
Any suggestions?
ADDRESS PATH "ls" WITH OUTPUT STEM files.
The environment PATH needs a command with its own program.
The environment SYSTEM allows shell interaction like
ADDRESS SYSTEM "ls | fgrep '.jpg'" WITH OUTPUT STEM files.
PATH cannot be used here because the pipe symbol "|" isn't
interpreted by Regina. On the other hand PATH is faster then
SYSTEM.
Cheers, Florian
Loading...