Register
It is currently Fri Oct 31, 2014 5:26 am

telnet to given ip addresses in text file


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon Feb 01, 2010 1:38 am   

Joined: Mon Feb 01, 2010 12:38 am
Posts: 1
Hi,
Currently I have script like below. It takes ip from command line and executes.
(echo open $1
sleep 1
echo username
sleep 2
echo password
sleep 2
echo "show interfaces description | match down | no-more"
sleep 5
echo exit
sleep 1
) | telnet


I wanted to modify this script to take IPs from text file instead of command line and writes output to text file. Requesting needful.

I have text file (iplist.sh) with below ip addresses.
97.253.1.100
97.254.2.108
97.252.8.252
97.251.3.34

Regards
Siva K


Top
 Profile  
 PostPosted: Wed Feb 03, 2010 10:40 am   
User avatar

Joined: Mon Jan 18, 2010 8:10 pm
Posts: 40
I am not sure what you are after, but reading values from a text file is very simple. Here is a very basic method:
Code:
$iplist=./iplist.sh
for IP in $(cat $iplist); do
     telnet $IP
done

Good luck! Stay on the right side of the law!


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP