I've written an Expect script that assists with change management on Cisco devices. The script creates log files for pre-change, the change itself, and post-change. Each log and its commands is triggered by a ! command.
For example:
Code:
./dochange.exp hostname
<script spawns bash, user SSHes to hostname>
!PRE
<script runs some show commands and logs to pre.log>
int f0/0
shut
<the above is logged to change.log>
!POST
<script runs some show command and logs to post.log>
All of this works fine. My big hair-pulling hiccup is that the resulting log files are filled with raw backspace characters!
I am using log_file to log the output from the script. I stop and restart logging with a new file when needed. However, the log files are pretty much unusable.
After doing some research, it looks like log_file sends output to the file in real-time, unbuffered. When I hit a key, it's immediately sent to the log. What I would like is for only the resulting string to go to the log.
If I start to type 'reload' and instead type 'show run', I don't want 'reload' to be listed in the log at all.
Anyone know if this is possible? Any help would be greatly appreciated!
Thanks,
Keller