Output terminal sessions to screen and log file

I would like to use a terminal session to ssh to switches and routers. I need to capture data while logged into switches to a file I can email for troubleshooting.

I use termial to log into Cisco switch, run the sh tech command, and then sent the output to cisco. Is there a way to run a script which will allow me to capture the sh tech output to a file. I am currently using the tcsh shell.

I am new to shell scripting so a good explaination would be greatly appreciated.

script?

maybe
script logfile.log
ssh router.myhost
commands...
exit
exit (from script)

I have not used it much though.

sh run | tee tftp://192.168.1.1/tftpboot/sh.run-confg

you have to create the sh.run-confg file on the tftpboot folder with write access

sh run | tee /append ftp://user:pass@ftp.xxx.com/sh.run.com

appand (append to the given FILEs, do not overwrite

for the mail application you have to use tcl script
router#tclsh

Cisco IOS Scripting with Tcl - Cisco Systems

The script logfile.log worked fine. Thank you very much.

I just wanted to send a personal thanks to Juhanitali for posting his "Script" solution. Took me 30 seconds to do a google search and I found your simple but power suggestion & solution. Has saved me HOURS.

Thanks for the post and extremely simple, yet POWERFUL solution.

Best regards,
Razer.
Toronto - Canada.