Hello Ruby friends!

I'm learning ruby and i already have some problems.

I have a file with Login and Ip address but not on the same line.
Exemple :

Login1
Address1
Login2
Address2
....


I searh a way to extract the IP address when i search the login
search.rb Login2
> address2 

I know how to search a pattern :

Login= File.open("users" ).each_line.grep( /Login2/ )
puts Login

First question : how can i see the line after ? the line with the Ip
address of that login

Second question : I don't search always the same pattern so i need to
pass an argument to my script. I tried this
Login= File.open("users" ).each_line.grep( /ARGV[0]/ )
puts Login
but it doesn't show anything

Third question : After having the ip address, i need to make an ssh
connection to this address. How can i get a variable to be usable in
system("ssh $variable") ?

Thanks for your help and sorry for my english, i hope it's
understandable.


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