I down't know AWK; however, why try to do it as AWK does it? Below is a couple of J statements which do what I think you are trying to do.
data=:1 2,3 4,5 6,:7 8 data 1 2 3 4 5 6 7 8 +/"1 data 3 7 11 15 The last .: maks the rank two. And I assume that when you say "print" you mean to the screen. Also, didn't bother to deal with using ; to delimit numbers. Why should I as it is so much easier to use blanks in J? But if you really want to do it exactly as in AWK then it would not be difficult. On Fri, Feb 14, 2014 at 7:51 PM, Lee Fallat <ircsurfe...@gmail.com> 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