<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - Need help assigning an IP address to a Varible]]></title>
		<link>http://railsforum.com/viewtopic.php?id=47986</link>
		<description><![CDATA[The most recent posts in Need help assigning an IP address to a Varible.]]></description>
		<lastBuildDate>Tue, 21 Feb 2012 17:14:47 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Need help assigning an IP address to a Varible]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=150023#p150023</link>
			<description><![CDATA[<p>Hello to the ruby world <img src="http://railsforum.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; I was hoping to get a bit of guidance... I<br />have the following code below that logs int to a cisco router and<br />performs a command:</p><br /><p>#!/usr/bin/env ruby<br />require &#039;rubygems&#039;<br />require &#039;net/ssh&#039;</p><p>HOST = &#039;143.132.16.43&#039;<br />USER = &#039;&#039;<br />PASS = &#039;&#039;</p><br /><p>puts &quot;Give me the ip address&quot; #(user enters 159.202.161.0)<br />@ipadd = gets</p><p>Net::SSH.start( HOST, USER, :password =&gt; PASS ) do|ssh|<br />ssh.exec(&#039;sho ip route &#039; + @ipadd)</p><br /><p>end</p><p>Below is the output form the above code (without the ##):</p><p>AMP_STL_Intra_SW4#sho ip route 159.202.161.0<br />Routing entry for ##159.202.161.0##/25<br />&nbsp; Known via &quot;connected&quot;, distance 0, metric 0 (connected, via interface)<br />&nbsp; Routing Descriptor Blocks:<br />&nbsp; * directly connected, via Vlan307<br />&nbsp; &nbsp; &nbsp; Route metric is 0, traffic share count is 1</p><p>AMP_STL_Intra_SW4#</p><p>I would like to scan this output and assign only the IP address between<br />the ##&#039;s to a variable for further use.&nbsp; I am new to programming so I&#039;m<br />sure this is amateur <img src="http://railsforum.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; Any help is mush appreciated.</p>]]></description>
			<author><![CDATA[dummy@example.com (jallen)]]></author>
			<pubDate>Tue, 21 Feb 2012 17:14:47 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=150023#p150023</guid>
		</item>
	</channel>
</rss>
