From: Daniel Carrera Date: 2003-02-12T06:51:03+09:00 Subject: Re: String frustration > No problems reading the file and doing everything else the way I want to, > and I end up with the string I intend to print out (that contains the > embedded newlines). BUT: no matter what I do, I can't get either puts or > print to substitute newlines for the "\n" sequences. Both methods just > print them out as is. Not good. Tell me if I understand the problem correctly. You have string of the form: str = 'line one\nline two\nline three' # Notice the single quotes. And you want to replace the characters '\n' by the actual new-line "\n". Did I understand correctly? If this is so, would a regex do what you want?: $ irb >> str = 'line one\nline two\nline three' => "line one\\nline two\\nline three" >> str.gsub!(/\\n/, "\n") => "line one\nline two\nline three" >> puts str line one line two line three => nil >> -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137