I have the following code:
File.open("/log/#{hostname}-#{@tdate}-errors.txt",'w') do |o|
run=tn.cmd('String'=>'sh int', 'Match'=>/#/) { |c| puts c}
run.each_line do |re|
title = re.match /([\S]+)Ethernet\S+/
rep = re.match /\d+ input errors/
#o.puts run
o.puts title
o.puts rep
end
end
tn.close
It writes to a file just fine, but adds a bunch of spaces between title and rep. How do I get rid of the spaces?