From: Brian Candler Date: 2009-06-23T03:59:57+09:00 Subject: Re: formatting a listing George George wrote: > but it prints out the same old original file without modifications It works for me (I just copy-pasted your code and changed the input/output filenames). The simplest way to debug this is to add some extra debugging statements to see if the variables contain what you expect, for example: ... rows = src.split("\n\n").collect { |b| b.split("\n") } p rows # << debugging statement or more verbosely, STDERR.puts "rows = #{rows.inspect}" At a guess, perhaps you're on a Windows platform and the paragraphs are terminated by \r\n\r\n instead of \n\n. Try: rows = src.split(/\r?\n\r?\n/).collect ... etc In a regular expression, \r? means 0 or 1 occurrences of \r -- Posted via http://www.ruby-forum.com/.