Thank you all very much for your help and responses. It will take me some time to digest it all but I will learn a lot more J from going through the proposed solutions.
I have tried out Dan's solutions and they are very quick and get the job done. I was unaware of the use of " #!.'0'~ 1 j. " so am reading about it now. I like this one a lot: (#!.'0'~ 1 j. ',,' E. ]) But because I have a 32-Bit machine at the moment, I am using the "chunkfy" method. Thanks again, Matthew. On Wed, Jul 30, 2008 at 1:36 AM, Dan Bron <[EMAIL PROTECTED]> wrote: > Raul wrote: > > If I start with the text 0,,,34567,,,abcd,,,efg and I use a > > I presume this is in response to my most recent post? If so, I'm not > surprised. > > I posted more to inspire further fully-tacit solutions than to actually > solve Matthew's problem. Mostly because I don't know > enough about that problem. For example: are quotes relevant, as Raul > wondered? Should ',',LF be replaced with ',0',LF, as > Devon suspects? How big can these files grow (can the raw data itself be > bigger than 2GB)? Will there ever need to be longer or > more sophisticated substitutions than ',,' ==> ',0,' ? > > If I were really trying to answer the question as asked, I would recommend > something along the lines the rest of you have > indicated: read the file in blocks, being careful about block boundaries, > and treat each block as true CSV in its full generality > (i.e. load 'csv' ). Since you have to loop over blocks anyway, the cost > of parsing CSV is negligible (and conveniently > sidesteps the issue of the underspecied domain). Chris' post is the > closest to how I would approach the problem "in real life". > > But, as I said, I didn't post to solve the problem "in real life", I posted > as if the problem were a puzzle, and the solution had > to be fully tacit. > > So I re-propose the puzzle. I challenge the rest of the Forum to post > fully tacit solutions, where elegance is the first > priority, efficiency the second, and generality the third. > > My solution won't win any prizes, but at least it was the first past the > post. > > -Dan > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
