({.,:,each/@:(,:each)@}.) ',' readdsv 'dept.csv' ┌──────┬──────────┬──────────┐ │deptno│dname │location │ ├──────┼──────────┼──────────┤ │10 │Accounting│"New York"│ │20 │Research │Dallas │ │30 │Sales │Chicago │ │40 │Operations│Boston │ └──────┴──────────┴──────────┘
,each/,:each }. ',' readdsv 'dept.csv' ┌──┬──────────┬──────────┐ │10│Accounting│"New York"│ │20│Research │Dallas │ │30│Sales │Chicago │ │40│Operations│Boston │ └──┴──────────┴──────────┘ (Though I would recommend using the jd addon, instead, if your data volumes are especially large.) I hope this helps, -- Raul On Wed, Aug 17, 2022 at 7:48 AM Pawel Jakubas <jakubas.pa...@gmail.com> wrote: > > Dear J enthusiasts, > > Let's say I have the following csv file > $ cat dept.csv > deptno,dname,location > 10,Accounting,"New York" > 20,Research,Dallas > 30,Sales,Chicago > 40,Operations,Boston > > Now I read it using dsv addon: > load 'tables/dsv' > readdsv jpath './dept.csv' > ┌──────────────────────┐ > │deptno,dname,location │ > ├──────────────────────┤ > │10,Accounting,New York│ > ├──────────────────────┤ > │20,Research,Dallas │ > ├──────────────────────┤ > │30,Sales,Chicago │ > ├──────────────────────┤ > │40,Operations,Boston │ > └──────────────────────┘ > ',' readdsv jpath './dept.csv' > ┌──────┬──────────┬──────────┐ > │deptno│dname │location │ > ├──────┼──────────┼──────────┤ > │10 │Accounting│"New York"│ > ├──────┼──────────┼──────────┤ > │20 │Research │Dallas │ > ├──────┼──────────┼──────────┤ > │30 │Sales │Chicago │ > ├──────┼──────────┼──────────┤ > │40 │Operations│Boston │ > └──────┴──────────┴──────────┘ > > Questions: > 1. How to read the file to get: > > ┌──────┬──────────┬────────┐ > │deptno│dname │location│ > ├──────┼──────────┼────────┤ > │10 │Accounting│New York│ > │20 │Research │Dallas │ > │30 │Sales │Chicago │ > │40 │Operations│Boston │ > └──────┴──────────┴────────┘ > > 2. How to omit header upon reading? > > Also the link in line does not work (I bet it should point to > https://github.com/jsoftware/tables_dsv/blob/master/test/test_dsv.ijs) > > To see more examples of usage, open and inspect the test_dsv.ijs > <http://www.jsoftware.com/wsvn/addons/trunk/> script. > > Thanks and cheers, > > Pawel > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm