why not this - even though it uses spaces instead of semicolons for
separators. while this may not be just what you want, at least the
result is numerical and can be operated on numerically.
file=:>1 2;4 5;6 7
file
1 2
4 5
6 7
+/"1 file
3 9 13
or this
+/|: file
3 9 13
file2=:>1 2 3;4 5 6;7 8 9
1 2 3
4 5 6
7 8 9
+/"1 file2
6 15 24
+/|: file2
6 15 24
Don Kelly
On 14/02/2014 6:51 PM, Lee Fallat wrote:
Hey there,
As new user to J (but several years experience with C and Java), I
find it very, very interesting. The power of its one liners and
mathematical heritage really have me hooked. I was wondering though
if it has similar capabilities as awk. What's the equivalent to this
awk script in J?:
BEGIN { FS=";" }
{ print $1+$2 }
This script sets a FieldSeparator to ;, and then for every "row", add
the first and second column and prints it. I would like to replace awk
with J!
Thank you,
Lee
P.S. Excuse me if I've misidentified J sentences. (Sentences -> statements?)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm