]data =. '1;2;3;4;5;' ,: '6;7;8;9;0;'
1;2;3;4;5;
6;7;8;9;0;

   <;._2"1 a
┌─┬─┬─┬─┬─┐
│1│2│3│4│5│
├─┼─┼─┼─┼─┤
│6│7│8│9│0│
└─┴─┴─┴─┴─┘

   2{."1 <  ;._2"1 a
┌─┬─┐
│1│2│
├─┼─┤
│6│7│
└─┴─┘

if data is already structured:

   i. 2 5 
0 1 2 3 4
5 6 7 8 9

   2{."1 i. 2 5
0 1
5 6




----- Original Message -----
From: Lee Fallat <ircsurfe...@gmail.com>
To: programm...@jsoftware.com
Cc: 
Sent: Friday, February 14, 2014 9:51:32 PM
Subject: [Jprogramming]  awk-like J sentences?

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

Reply via email to