results = commands.collect{|i| host.cmd(i)}
.collect{ |i| i.collect{ |i| i.chomp }[1..-2] }
(reformatted slightly)
What this code does: takes a list of commands to run over a telnet session, runs them all, takes the output for each command, splits it into an array of lines (removing any stray newlines on each line), strips off the first and last lines of the output (since the first line is just an echo of the command and the last line is the command prompt again), and returns an array of lines of the output for each command in an array.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):