LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 01-23-2007, 07:01 AM   #1
Manana
Member
 
Registered: Dec 2005
Distribution: Ubuntu,Debian
Posts: 41

Rep: Reputation: 15
get output from telnet session?


Ok this is my problem: I have a script that uses expect, it logs(telnet) onto a ciscorouter and can excecute commands there.
I need to excecute a command on the ciscorouter and then send the output to my PC(where im running the script).

Something like this

send "show running-config" > /example/config

thats how i would like to do it but thats not working, how can i do this ?

Help much appreciated! Thanks!
 
Old 01-23-2007, 07:53 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
the example i already gave you does this, does it not??
 
Old 01-23-2007, 08:06 AM   #3
Manana
Member
 
Registered: Dec 2005
Distribution: Ubuntu,Debian
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks for the previous help, however the problem with your way of doing it is that i seem to be getting alot of other text in the logfile other then the output from the command wich is a big problem if i want to restore config from that file aswell.

With other text i mean the actual commands and stuff like that, maybe im doing it wrong. Any ideas? isnt it just possible to pipe the output to a local file?
 
Old 01-23-2007, 02:24 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
it's just a case of turning logging on and off at the right time. you can see in my example i chop and change between log files to only caputer the relevant pasrts. i even type in "show run", change the log file and *then* press enter, so none of my input is listed.
 
Old 01-24-2007, 03:20 AM   #5
Manana
Member
 
Registered: Dec 2005
Distribution: Ubuntu,Debian
Posts: 41

Original Poster
Rep: Reputation: 15
Aha ok i see, cant really get it working here.
Im using a telnet session instead of ssh, so its a bit different.
Maybe i could just pipe all the output from the telnet session to file and then grep the parts i want.

I know i can grep a number of lines after a value but can i grep everything between two values ? like this:

1
2
want to grep
this text.
3
4

Can i grep everything starting from 2 ending at 4 ?

Thanks for all your help btw acid_kewpie! really need it
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to log command output from telnet session even after logout from the remote serve UltraSoul Solaris / OpenSolaris 2 10-15-2006 09:20 PM
Running Telnet in a script, want to save Telnet output, howtodothis??? anil3 Linux - Software 2 03-08-2006 05:01 PM
telnet session slow froggo Linux - General 2 06-14-2005 03:37 PM
Pipe telnet session output to text file joshlamerritt Linux - Software 3 02-10-2004 09:42 PM
See a telnet session log Linux - Newbie 5 01-13-2003 09:11 AM


All times are GMT -5. The time now is 11:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration