At 11:29  +0200 2007/05/27, david alis wrote:
When I start jw on ubuntu64 and run the following:
'a b c' =. 2!:2 '/usr/bin/perl -n -e ' "print" '
the j session vanishes.

Where can I find examples of using 2!:2?
(I've tried the FindInFiles but I didnt find anything useful).

In perl I can use a pipe as if were an input file - (for example):
open F, 'cat inputfile | tr -d "7Z" |";
@wholefile = <F>;  # the variable @wholefile will contain either 7 or Z

Would I use 2!:2 to do something similar?

Thanks in advance.
David

I agree with Raul that you have a wayward ' in your j expression.

----

   version ''
Binary: j601binc_darwin_powerpc
Library: j601libc
Help: j601hlpc
Engine: j601/2006-11-17/17:05
ProductName:    Mac OS X
ProductVersion: 10.4.9
BuildVersion:   8P135
java version "1.5.0_07" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164) Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)

   'a b c' =. 2!:2 '/usr/bin/perl -n -e  "print" '
   a
2556
   b
_1610556620
   c
_1610556532
   1!:20 ''
+-----------+------------------------------+
|_1610556620|</usr/bin/perl -n -e  "print" |
+-----------+------------------------------+
|_1610556532|>/usr/bin/perl -n -e  "print" |
+-----------+------------------------------+

   host =: 2!:0 :: 0:

   host 'ps -aux | grep 2556'
jkt 2563 0.7 0.0 27812 580 p2 R+ 9:35AM 0:00.01 sh -c ps -aux | grep 2556 > /var/tmp/tmp.4.oglJt2 jkt 2556 0.0 0.0 27248 448 p2 S+ 9:33AM 0:00.01 /usr/bin/perl -n -e print
jkt       2565   0.0  0.0    27812      4  p2  R+    9:35AM   0:00.00 grep 2556

NB. So the process is running as expected with PID a - but

   'Where does this go?' 1!:2 b
   1!:1 c
|limit error
|       1!:1 c

NB. I don't know....

----

I'm guessing that your idea is to run some kind of filter in the
host environment and send/receive stdin/stdout - I would be
interested in doing that too. I like being able to read stdin in
#! j scripts - but the external filter would be nice, egrep leaps
to mind as useful. Let me know if you puzzle it out.

- joey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to