<cffile action="READ" file="C:\Inetpub\wwwroot\test\test.txt"
variable="stuff">
<cfloop index="i" list="#stuff#" delimiters="#chr(10)##chr(13)#">
<cfset variables.part = trim(i)>
<cfset variables.partlen = len(variables.part)>
<cfset variables.newpart = left(variables.part, variables.partlen -
1)>
<cfoutput>#variables.newpart#<br></cfoutput>
</cfloop>
Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org
-----Original Message-----
From: Andre Turrettini [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30, 2002 10:48 AM
To: CF-Talk
Subject: RE: cffile parsing problem
You might want to start by replacing ",#Chr(10)##Chr(13)##Chr(10)##Chr(13)#"
with a pipe or something. Then you can just loop thru the pipe for each
line.
DRE
-----Original Message-----
From: Seamus Campbell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30, 2002 8:53 AM
To: CF-Talk
Subject: cffile parsing problem
Hi all
I have a txt file (I cannot change the format) which I want to
insert/update into an access database online.
I've been trying to read the file using CFFILE but cannot parse it properly
This is the file:
"SUS","BUTTER","1876334568","Attracting Butterflies to Your Garden","CLYNE
DENSEY",23.95,1,"TP","",
"SUS","CATTLE","0882660667","Family Cow","VAN LOON DIRK",29.95,2,"PB","",
"SUS","CATTLE","0911311688","Natural Cattle Care ACRES USA ED","COLEBY
PAT",49.50,0,"TP","",
"SUS","COMPOS","0670904678","Australian Self Sufficiency Ha","SMITH
KEITH",39.95,0,"TP","1992",
"SUS","CONIFE","1876473312","Gardening With Conifers","BLOOM
ADRIAN",42.90,0,"HB","2001",
"SUS","COOKIN","0732265517","Best of Jackie French","FRENCH
JACKIE",24.95,1,"TP","",
"SUS","COWSMI","086417120X","Keeping a Cow","WILSON JIM",0,0,"TP","1987",
I don't know how to get rid of the last comma in each line, and then how to
parse with a blank line between each record.
I've tried this
<CFFILE action="READ"
file="D:\InetPub\wwwroot\_Candelo\database\candeloweb1603.txt"
variable="Candelo">
<!--- Set a variable to hold the ascii values for a line break and a
carriage return --->
<CFSET new_line=Chr(10) & Chr(13)>
<!--- Loop thru lines of text --->
<CFLOOP index="i" list="Candelo" delimiters="new_line">
<cfoutput>#Candelo#</cfoutput><BR>
</CFLOOP>
and get this (but repeated three times!)
"SUS","BUTTER","1876334568","Attracting Butterflies to Your Garden","CLYNE
DENSEY",23.95,1,"TP","", "SUS","CATTLE","0882660667","Family Cow","VAN LOON
DIRK",29.95,2,"PB","", "SUS","CATTLE","0911311688","Natural Cattle Care
ACRES USA ED","COLEBY PAT",49.50,0,"TP","",
"SUS","COMPOS","0670904678","Australian Self Sufficiency Ha","SMITH
KEITH",39.95,0,"TP","1992", "SUS","CONIFE","1876473312","Gardening With
Conifers","BLOOM ADRIAN",42.90,0,"HB","2001",
"SUS","COOKIN","0732265517","Best of Jackie French","FRENCH
JACKIE",24.95,1,"TP","", "SUS","COWSMI","086417120X","Keeping a
Cow","WILSON JIM",0,0,"TP","1987",
Can anyone give me some clues or help please
Many thanks
Seamus
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists