Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

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

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

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,242
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]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.