Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I replace the /r/n with /n?

Status
Not open for further replies.

BobLaw

Programmer
Oct 2, 2000
27
0
0
US
Hello,

I have a problem, our application is writing a file
to an NT directory using this call,
<cffile action=&quot;write&quot; file=&quot;C:\Netscape\SuiteSpot\docs\keyfile\Test\#Variables.NewLicenseNo#.#form.hostID#&quot; output=&quot;#cfhttp.FileContent#&quot;>
The contents come from a Perl script on a unix server.

The problem is that the newlines are being changed to /r/n
(^M) carriage return line feed pairs. This is a problem for the people receiving this file because they need to use VI/EDT to strip out the (^M)'s out of the file before they can use it on their solaris systems.

I guess my question is, how can I have CF read and replace the &quot;^M&quot;'s in that file and save it? Can this be done?
If so could you please explain by example, I am still new to this and I am finding these things a bit hard right now.

Thanks.


[sig][/sig]
 
<cfset lnBrk = &quot;#chr(13)#chr(10)#&quot;>
<cfset newStr = Replace(string, lnBrk, &quot;#chr(10)#&quot; , &quot;ALL&quot;)>

Might take a look at an ascii chart there all over the net
make sure I got the chr()'s right.... [sig][/sig]
 
Thanks, that will help for other problems.

I found what was causing the added (^M)'s in my file,
I had to add (addnewline=&quot;No&quot;) to the cffile call and no more added (^M)'s :)...

Take care.

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top