Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expect Scripting - Remove Clear Screen

Status
Not open for further replies.

RF101

Technical User
May 17, 2006
33
0
0
US

I have redirected the output from my telnet session to a text file.

The text file contains ANSI characters that I do not want, example:

Erase from cursor to end of screen \027[J or \027[0J




Is there a way to suppress these characters so that they do not show up in the output file?
 
What OS are you using and what method are you using to redirect the output?
 


I found a solution for this problem. I ended up using a sed regular expression to remove all of the special characters and create a new cleaned file.

RF
 
I was going to suggest sed if you were in the right OS. Should it come to it and/or as an alternate option, take a look at the man pages for the 'cat' command. I haven't worked with *nix OSs for a couple of years, but if memory serves there was a -v option that would cause otherwise non-printable characters to print as various ^I or the \027[J expressions you were seeing. These can be filtered off a little more visibly as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top