> I want to execute a command consisting of couple of "|" pipes in it.
> For e.g. "dir | grep gpc | grep -v 25". So did this like,
[quoted text clipped - 7 lines]
> that is, I see the output of "dir | grep gpc" only the rest "grep -v
> 25" command does not get into act.

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Hey Thanks Gordon,
That helped :-). Yep, in unix I had to pass the String[] as you have
mentioned below, but in NT it worked in a single String, like, String
cmd = "cmd /c dir....."
So bottomline is for all shell specific feature one has to pass chell
as a first parameter to the execution.
One more thing, Gordon, can you pls elaborate more on your quote ,
> Note too that your specific example is easily implemented in pure Java.
I did not quite understand it. Is there any better way of executing and
extenal command and get it's out put in the program.
Thanks,
~jaideep
> > I want to execute a command consisting of couple of "|" pipes in it.
> > For e.g. "dir | grep gpc | grep -v 25". So did this like,
[quoted text clipped - 37 lines]
> [ don't email me support questions or followups ]
> g o r d o n + n e w s @ b a l d e r 1 3 . s e
Gordon Beaton - 08 Aug 2006 07:40 GMT
> One more thing, Gordon, can you pls elaborate more on your quote ,
>> Note too that your specific example is easily implemented in pure Java.
>
> I did not quite understand it. Is there any better way of executing and
> extenal command and get it's out put in the program.
I was referring to the specific command you were having problems with,
which does not require running an external program at all:
dir | grep gpc | grep -v 25
You can do this in pure Java: read the directory with
File.listFiles(), then iterate over the resulting list to compare each
filename with "gpc", etc.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
jaideep.barde@gmail.com - 08 Aug 2006 09:31 GMT
Oh, I get it. But that was just an example, I wanted to run several
different command, gather their output and provide some consolidated
report against that output.
Thanks for all your time and help. May be will ping you later for some
more help :-), I've just started picking up java
> > One more thing, Gordon, can you pls elaborate more on your quote ,
> >> Note too that your specific example is easily implemented in pure Java.
[quoted text clipped - 16 lines]
> [ don't email me support questions or followups ]
> g o r d o n + n e w s @ b a l d e r 1 3 . s e