What would be the best way to parse a large text file (>5mb)?  Actually,
the text file is 1 large string.  I need to create either a file with
each new record on a line or enter each new record into a table (new
record = every 60 chars).

 

Here's what I've tried, but there must be a more efficient way.

 

<cffile action="Read" 
    file="C:\temp\MATCHMST\MATCHMST.txt" 
    variable="message">

 

<cfset recordLength = 60>
<cfset messageLen = Len(message)>
<cfset messageRecords = messageLen/recordLength>

 

<cfloop index="loopCount" from="1" to="#messageRecords#">
 <cfset new_record = Left(message, recordLength)>
 <cfoutput>#new_record#<br></cfoutput>
 <cfset message = RemoveChars(message, 1, recordLength)>
</cfloop>

 

<cfoutput>
File is done!
</cfoutput>

 

OR 

 

<cffile action="append"
  file="C:\temp\MATCHMST\NEW_MATCHMST.txt"
  output="#new_record#"
  addnewline="yes"> 

 

OR


  <cfquery name="insertRecord" datasource="db1">
  Insert into matchmst (matchmst)
  Values ('#new_record#')
  </cfquery>

 

Thanks,

Issac


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
                                

Reply via email to