Using the freads
verb will force line endings to be LF
. If you are using J6 or earlier then you will need to load the files script first (load 'files'
), otherwise freads
is available as part of the standard library. Then as Eelvex suggests cut ;.
more specifically ;._2
can be used to divide the lines of the file using the last character in the string (in this case LF
) as the delimiter:
_99&".;._2 freads 'myfile.txt'
It is better to use Numbers (dyadic ".
) to convert literals to numeric rather than Do (monadic ".
). This avoids the potential security issue of "executing" code in the file and will correctly convert more variations, compare the following:
". '45 -34' NB. monadic ".
11
_99 ". '45 -34' NB. dyadic ".
45 _34
You may find the following faster:
_99 ". ];._2 freads 'myfile.txt'
Numbers
is acting on the whole array at once rather than being run on each line individually.