Je le code suivant:question de sortie rubis
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
Il écrit dans un fichier très bien, mais ajoute un tas d'espaces entre le titre et le représentant. Comment puis-je me débarrasser des espaces?
Qu'est-ce 'tn'? L'échantillon semble être incomplet. –
Cest où j'établis une connexion telnet – nomoreflash
À quoi ressemble la sortie typique de la commande 'telnet'? –