Which version of CF?
--
jon
mailto:[EMAIL PROTECTED]
Tuesday, June 10, 2003, 7:13:11 PM, you wrote:
IR> What would be the best way to parse a large text file (>5mb)? Actually,
IR> the text file is 1 large string. I need to create either a file with
IR> each new record on a line or enter each new record into a table (new
IR> record = every 60 chars).
IR> Here's what I've tried, but there must be a more efficient way.
IR> <cffile action="Read"
IR> file="C:\temp\MATCHMST\MATCHMST.txt"
IR> variable="message">
IR> <cfset recordLength = 60>
IR> <cfset messageLen = Len(message)>
IR> <cfset messageRecords = messageLen/recordLength>
IR> <cfloop index="loopCount" from="1" to="#messageRecords#">
IR> <cfset new_record = Left(message, recordLength)>
IR> <cfoutput>#new_record#<br></cfoutput>
IR> <cfset message = RemoveChars(message, 1, recordLength)>
IR> </cfloop>
IR> <cfoutput>
IR> File is done!
IR> </cfoutput>
IR> OR
IR> <cffile action="append"
IR> file="C:\temp\MATCHMST\NEW_MATCHMST.txt"
IR> output="#new_record#"
IR> addnewline="yes">
IR> OR
IR> <cfquery name="insertRecord" datasource="db1">
IR> Insert into matchmst (matchmst)
IR> Values ('#new_record#')
IR> </cfquery>
IR> Thanks,
IR> Issac
IR>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Host with the leader in ColdFusion hosting.
Voted #1 ColdFusion host by CF Developers.
Offering shared and dedicated hosting options.
www.cfxhosting.com/default.cfm?redirect=10481
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4