Search and Replace text


apologies no doubt simple question - i'm trying out , i'm not programmer, although maybe 1 day...

 

anyway, i'm going need read text file, , search string in text file , replace it.  see "replace" function i'm not familiar how use it.  poking around found <cffile action=append> , used add a line text document.  (just notepad .txt)

 

ultimately i'll need unzip folder, search , replace string in specific file in there, , re-zip file, we'll later.  managed unzip folder already, that's easy enough.  putting current challenge.

 

i'm using coldfusion builder 2.0

 

 

thanks guys can give.

file.txt: contains several lines "all work , no play makes jack dull boy".

 

<cffile action="read" file="c:\file.txt" variable="myfile">

<cfset myfile = replace(myfile,"dull","bored","all")>

<cffile action="write" file="c:\file.txt" output="#myfile#" addnewline="no" fixnewline="no">

<cffile action="read" file="c:\file.txt" variable="mynewfile">

<cfoutput>#mynewfile#</cfoutput>

 

^_^



More discussions in ColdFusion


adobe

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP