There's a topic always asked about on forums and the answers are typically wrong, unuseful, doesnt work, etc.. I had the same problem, I figured it out so I thought about posting it here. How to save the infamous telnet output automatically to a file on your pc.
Install expect by doing:
sudo apt-get install expect
then, do an expect script of your telnet session, the way you want it. (internet is full of articles about expect scripting, and believe me it's real easy!)
then in terminal launch the script using expect and use the program "tee" to redirect the output to a file on ur pc.
we have an expect script called fetch.
in terminal we do:
expect fetch | tee example.txt
this command will launch connect to telnet, automatically do the commands u put in the fetch script, and send all the output till the end to a file in ur current directory named example.txt
if the operation is a routine (fetching data for example regularly) u can add the command to cron to schedule it to run anytime u want automatically and save u the output data.
to do that enter crontab -e in terminal and add the job there, or alternatively do:
sudo apt-get install gnome-schedule
and edit cron graphically, but needless to say, the terminal gives u a wider set of control and options on cron.
Incoming search terms:
- telnet output to file linux
- telnet save to file
- redirect telnet output to file
- expect output to file
- linux telnet output to file
- save telnet output to file
- telnet output to file
- save telnet output to file ubuntu
- ubuntu save telnet
- ubuntu log telnet session to file