--- PackRat wrote:
> Yes, I'm quite sure that I have enough information to work with.
> Thanks again to everyone who responded!
> 
> I'll answer your further questions, though:
> 
I'm not sure if you wanted further help at the moment, if not then stop
reading now!! ;-)

I think the following verb should read and clean up all of the file
types except the "pure textual data". 
You may want to treat them as a special case and deal with them
separately. Alternatively you could leave all the files boxed and work
with boxed data rather than literal arrays.

libread=: 3 : 0
  cnt=. 'b' freads jpath y NB. read file into boxed list
  nums=. (48+i.10){a.      NB. numbers
  lowerc=. (97+i.26){a.    NB. lowercase letters
  ishead=. -.+./ (0{:: cnt) e. lowerc,nums NB. test for header line
  cnt=. ishead }.cnt       NB. drop header if necessary
  cnt=. >'"' -.~ each cnt  NB. remove any double quotes and unbox to
literal matrix
  ispref=. *./ ({."1 cnt) e. lowerc  NB. test for prefix
  cnt=. ispref }."1 cnt    NB. drop prefix if necessary
)

dat=. libread '~temp/myfile.txt'  NB. To read file into noun dat
dat fwrites jpath '~temp/myfileproc.txt'  NB. To write noun to file
again.


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

Reply via email to