Hello,

Goal: read from an ascii input text file, skipping all whitespace lines
(any number of them), and only store text lines in boxes.

For example below, only line 3 and 4 should be stored in boxes (vim
test.txt, :set nu list):

1 $
2 ^I$
3 Line #3. Line #1 is LF, and line #2 is a TAB + LF.$
4 Line #4. Below, line 5 is a TAB + LF; line 6 is space<TAB>space.$
5 ^I$
6  ^I $
7 $


I looked at the stdlib, but I couldn't find a verb or a combination of them
to do the job cleanly. I ended up hacking (incorrect logic) like the
following:

d =. fread < 'test.txt'
b =. LF splitstring d
# each b

+-+-+--+--+-+-+-+-+
|0|1|50|64|1|3|0|0|
+-+-+--+--+-+-+-+-+

] lines =. > (3&<) each # each b

0 0 1 1 0 0 0 0

lines # b


Ques is, is there a better (and proper) way?


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

Reply via email to