From: Stewart Midwinter Date: 2002-05-06T13:13:38+09:00 Subject: Re: newbie Q: how to strip blank lines from file? Well, I found a solution to my problem using code examples on-line for "The Ruby Way", chapter 4; specifically, using p222c.rb and p230.rb. Here is my version, including some non-essential additional features that comment on the lines in the text. Of course, David Black's solution is much shorter and more elegant; thanks David! --- arr = IO.readlines("lists.html") lines = arr.size puts "myfile has #{lines} lines in it." longest = arr.collect {|x| x.length}.max puts "The longest line in it has #{longest} characters." shortest = arr.collect {|x| x.length}.min puts "The shortest line in it has #{shortest} characters." File.open("lists.out","w") do |file| arr.each do |line| file.puts line if line =~ /\S/ end end -- Stewart Midwinter stewart 'at' midwinter 'dot' ca