Yep - this should get you started:
<cfscript>
filename = "/path/to/file.csv";
fileReader = createObject("java", "java.io.FileReader");
fileReader = fileReader.init(filename);
lineReader = createObject("java","java.io.LineNumberReader");
lineReader = lineReader.init(fileReader);
line = lineReader.readLine();
/* this'd keep reading in lines
while (isDefined("line")) {
lineCount = lineCount + 1;
// do something here with the data in variable line
line = lineReader.readLine();
}
*/
</cfscript>
<cfoutput>#line#</cfoutput>
-joe
On Fri, 3 Dec 2004 15:55:01 +0100, Pascal Peters <[EMAIL PROTECTED]> wrote:
> No, but I think you can do it with java.
>
>
>
> > -----Original Message-----
> > From: Jeremy Bunton [mailto:[EMAIL PROTECTED]
> > Sent: 03 December 2004 15:52
> > To: CF-Talk
> > Subject: <cffile read> to read JUST the top line of the txt file.
> >
> > Hello,
> >
> > I want to use <cffile> to read just the top line (header line with
> field
> > names) of a very large .csv file, say 5 million records. Is there a
> way to
> > just read the top record into the variable in the cffile tag, with out
> > having to read the whole file.
> >
> > Jeremy
> >
> >
> >
> >
> >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186087
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54