[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing VT220 control characters with GAWK

From: Bob Proulx
Subject: Re: Removing VT220 control characters with GAWK
Date: Thu, 17 Apr 2008 11:46:35 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Dylan VanHerpen wrote:
> I've been trying to use GAWK to remove VT220 control characters from an
> Expect capture file.

I am sure that awk can do this because it is very general purpose.
But 'col' will also do this out-of-the-box.  You might want to try
'col -b' which is the common idiom that I typically use.

> The pattern I'm trying to remove is as follows:
>       ESC[xx;xxH
> Where 'xx;xx' represents the row/column. What I'd like to do is
> something like this:
>       { FS = "\033\[*H"; OFS = "," }
> So far, I've had no luck removing the escape strings, or even just the
> escape code (\033) itself. Am I going the wrong way about this?

I personally wouldn't attack the problem by using the field separator.
I would probably just use gsub across the pattern space.  (Well,
actually I would just use 'col'. :-)

Alternatively if you can avoid generating the terminal escape
sequences in the first place then they wouldn't need to be removed.
In most cases setting TERM=dumb will avoid this problem at the start.
It all depends on your application and why you are using expect in
the first place.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]