MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Writing and reading a comma delimited or tab delimited file one record at a time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68255] Writing and reading a comma delimited or tab delimited file one record at a time
  • From: "Richard Palmer" <rhpalmer at gmail.com>
  • Date: Mon, 31 Jul 2006 03:45:07 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I need to be able to write a large file with delimited fields with a
new line symbol separating records.  Since the files can be very
large, I can't create or read them all at once and work with them in
memory.  It would be nice to create small sample files I can look at
in EXCEL (I'm on a MAC).  The files I need to create consist of 5
string valued fields and a positive real number.  I suspect this is
simple, but I can not see a simple way to do it from the
documentation:  The goal is to take

alfa code 1
...
alfa code 5
amount

to

alfa code1, alfa code 2, ... , alfa code t, amount \nl

(the comma is a ',' or  some other separator) in writing the file and,
correspondingly, be able to read the file back

I guess I'm a little surprised there are no ImportLine or ExportLine
commands corresponding to the Import and Export commands.  It's always
nice to be able to work with all the data.  However, sometimes there
is too much data and we need to be able to work with summaries.

Thanks


  • Prev by Date: Using implicit information about row indices
  • Next by Date: numerical capabilities
  • Previous by thread: Using implicit information about row indices
  • Next by thread: numerical capabilities