For Programmers: Free Programming Magazines  


Home > Archive > Rexx > April 2005 > Regina-REXX/Linux: processing output from Linux Commands









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Regina-REXX/Linux: processing output from Linux Commands
Mike H

2005-04-01, 8:58 pm

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, 8:58 pm

In comp.lang.rexx Mike H wrote:

> 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-06, 12:26 pm

In article <Bqh3e.19306$f%4.4375@bignews1.bellsouth.net>,
Mike H <mhammoc@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
ptjm@interlog.com
Florian Große-Coosmann

2005-04-06, 12:26 pm

Mike H schrieb:
> 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-06, 12:26 pm

I love examples, and that looks almost exactly like what
I want to do....
Thanks!!
(and thanks for the other replies also!)

Mike


Florian Große-Coosmann wrote:
> Mike H schrieb:
>
>
>
> 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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com