Parse the file as a list, with a carriage return as your delimiter. Each
list element will represent a line. ListDeleteAt() any lines that are
empty.
<cfset lineNum = 1>
<cfloop index="thisLine" list="#fileContents#" delimiters="#chr(10)#">
<cfif not len(trim(thisLine))>
<cfset fileContents = listDeleteAt(list,lineNum,chr(10))>
<cfelse>
<cfset lineNum = lineNum + 1>
</cfif>
</cfloop>
---
Billy Cravens
----- Original Message -----
From: "C. Hatton Humphrey" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, December 11, 2001 8:40 AM
Subject: Trimming Files
> Does anyone have a quick way to trim extra lines from a text file?
>
> I have an app that uploads a text file and processes it as a TSV file, but
> some users are exporting from MS Access, which is adding some extra line
> feeds to the end. Any suggestions?
>
> C. Hatton Humphrey, Developer
> Fisher, Towne & Associates
> 716-839-2141 x336
> [EMAIL PROTECTED]
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
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