Re: Writing and reading a comma delimited or tab delimited file one record at a time
- To: mathgroup at smc.vnet.net
- Subject: [mg69116] Re: [mg68255] Writing and reading a comma delimited or tab delimited file one record at a time
- From: Igor Antonio <igora at wolf-ram.com>
- Date: Wed, 30 Aug 2006 06:34:03 -0400 (EDT)
- References: <200607310745.DAA26735@smc.vnet.net>
- Reply-to: igora at wolf-ram.com
- Sender: owner-wri-mathgroup at wolfram.com
Richard Palmer wrote: > 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 Mathematica has "lower-level" functions that let you read/write to a file. Take a look at the documentation: Built-In functions > Input and Output > File Output. Take a look at Write and WriteString, specifically. Igor -- -- Igor C. Antonio Wolfram Research, Inc. http://www.wolfram.com To email me personally, remove the dash.