Hi!

I'm trying to read a tab delimited file from Excel.

It contains empty columns at the end of the lines (except the header
line).

However, the last empty column contains blanks that I must trim away.

No big deal but I'd like to know how to read the file "by the book".

I read the file like this:

   tab=.9 { a.
   
   tbl=: <;._2 "1 (,.&tab 'm' freads 'test.txt')
   
   ]hdr=.{.tbl
+--+-+--+--+
|id|c|a1|a2|
+--+-+--+--+
   
   ]dat=.}.tbl
+-+-++-----+
|1|a||     |
+-+-++-----+
|2|b||     |
+-+-++-----+
|3|c||     |
+-+-++-----+

This is the file test.txt (^I=tab, $=LF):

id^Ic^Ia1^Ia2$
1^Ia^I^I$
2^Ib^I^I$
3^Ic^I^I$

The J version is 6.01c (j 6.02a downloaded, not yet installed)

Any suggestions?

Esa

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

Reply via email to