I understand now. Thanks for the clarification.
On Thu, 8 Aug 2002 15:04:08 -0400, Timothy Heald wrote: > Your over complicating that man. You only need the replace. See you are > reading the whole text file into a single variable. Then you want to go > through all of it and replace the $data variable. Right now though you are > replacing the whole text file in one foul swoop, only you are replacing it > with a single row from the text file. This should do it: > > <cfoutput> > > <cffile action="read" file="C:\file.txt" variable="ListLoop"> > > <cfset strCR = Chr(10)> > <cfset strWS = Chr(13)> > > <cfset ListLoop=#Replace(ListLoop,"#strCR#","<br>","ALL")#> > > <cfset ListLoop=#Replace(ListLoop,"$DATA\\","D:\data\","ALL")#> > > <hr> > #ListLoop# > <hr> > </cfoutput> > > Tim > > -----Original Message----- > > From: FlashGuy [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, August 08, 2002 2:55 PM > > To: CF-Community > > Subject: Reading in external file and manipulating data > > > > > > Hi, > > > > I'm not understanding something with the <cfloop. I have the > > below code which I want to read in a file and then search for > > specific lines of text for "=$DATA" *only* and then > > perform a search and replace on the "=$DATA" to "D:\data". The > > below code works but I only want the lines that I'm doing the > > substitute on to output to screen or to a file. > > > > Here is just a snippet of the data.txt file I'm reading in. > > > > data.txt > > ====== > > > > ..lines at top of file I don't want read in > > > > DIR1=$DATA\\DIR1 > > DIR2=$DATA\\DIR2 > > DIR3=$DATA\\DIR3 > > DIR4=$DATA\\DIR4 > > DIR5=$DATA\\DIR5 > > > > ..more junk here I don't want read in... > > > > > > Here is my code > > > > test.cfm > > ====== > > > > <cfoutput> > > > > <cffile action="read" file="C:\file.txt" variable="ListLoop"> > > > > <cfset strCR = Chr(10)> > > <cfset strWS = Chr(13)> > > > > <cfset ListLoop=#Replace(ListLoop,"#strCR#","<br>","ALL")#> > > > > <cfloop list="#ListLoop#" Index="Line" Delimiters="#strCR#"> > > > > <cfset > > ListLoop=#Replace(ListLoop,"$DATA\\","D:\data\","ALL")#> > > > > <hr> > > #ListLoop# > > <hr> > > </cfloop> > > > > > > > > > > > > > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
