The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: find and replace string in a text file
Replies: 23   Last Post: Mar 26, 2015 1:38 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,850
Registered: 6/7/07
Re: find and replace string in a text file
Posted: Mar 24, 2013 1:28 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 3/24/2013 11:57 AM, Amirhossein Hossein wrote:
> I have written the following code to find and replace a number in a text
> file.
> fin = fopen('Data.tcl');
> fout = fopen('MData.tcl','w');


> The only problem is in the MData.tcl is that all lines appears in the
> first line (shown below). Could you please guide to figure it out?


fin = fopen('Data.tcl','rt');
fout = fopen('MData.tcl','wt');

Use the 't' for text files to force the correct \n character for the OS
(namely Windows).


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.