open("file").each do |line|
  line.chomp!
  fields = line.split(/\s*\|\s*/)
  fields.delete ''  # or  fields.delete_if {|x| x=~/^\s*$/ }
  fields.each{|x| print "#{x}\n"}
end

-- 
Posted via http://www.ruby-forum.com/.