Thanks John.  I tried your example, but this does not actually work like
it appears.

Take your example text and add some fields delimited by one pipe
#chr(124)# and then terminiate the record with three #chr(124)#.

As you will notice the <cfloop> is delimiting on the first pipe
character is finds.

Troy

John Stanley wrote:

> <cfsavecontent variable="the_text_variable">
>    <cfinclude template="your_text_file.txt">  </cfsavecontent>
>
>
> <cfloop index="line" list="#the_text_variable#"
> delimiters="#CHR(124)##CHR(124)##CHR(124)#">
>     look at every element
> </cfloop>
>
> -----Original Message-----
> From: Troy Simpson [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 03, 2003 12:39 PM
> To: CF-Talk
> Subject: Re: Parsing a Unix Text File.
>
> Thanks.  This works.
>
> I presume that ColdFusion MX (6.1) does not have any way to parse text
> that uses multiple character delimiters, Right?
>
> So if I had a file that delimited the records by triple pipes "|||",
> there is nothing in ColdFusion that will let you do this, right?
>
> Thanks again,
> Troy
>
> Jerry Johnson wrote:
>
> > Try replacing two chr(10)'s with another character before you start,
> > and use that as the line delimiter.
> >
> > <cfset txtVar=replace(txtVar,chr(10)&chr(10),chr(13),"ALL")>
> >
> > Jerry Johnson
> >
> > >>> [EMAIL PROTECTED] 11/03/03 10:32AM >>>
> > I have a Unix Text File where the fields are delimited by one NewLine
> > "chr(10)" and the records delimited by two NewLines "chr(10)".
> >
> > I tried to use getToken to get the first record, but all I getting it
> > the first field in the first record.
> >
> > <cfset record = getToken(txtVar, 1, "#chr(10)##chr(10)#">
> >
> > My file would look something like this:
> >
> > <!--- Start of File --->
> > FirstName: Troy
> > LastName: Simpson
> > Phone: 919-555-1212
> >
> > FirstName: Tom
> > LastName: Hanks
> > Phone: 919-555-1313
> > <!--- End of File --->
> >
> > Why does this not work?
> > Any ideas how I can do this?
> >
> > Thanks,
> > Troy
> >
> >
>   _____  
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to