removing ASCII escape chars from output

S

SuperGh0d

Hello all,

I have some output that looks like this

$B"+(B[21;32H1700$B"+(B[21;44HTC HUMATHROPE

and I am trying to extract the 1700 and HTC HUMATHROPE. Can someone
point me in the right direction?

thanks!
 
J

John W. Krahn

On Sat, 22 Dec 2007 14:40:40 -0800 (PST)
Subject: removing ASCII escape chars from output

I have some output that looks like this

â†[21;32H1700â†[21;44HTC HUMATHROPE

There is only one ASCII escape character in there, *the* ASCII escape character. The other characters '[', '2', '1', ';', '3', '2', 'H', etc. are just normal ASCII characters.

and I am trying to extract the 1700 and HTC HUMATHROPE. Can someone
point me in the right direction?

You need to remove the ANSI escape sequences:

http://isthe.com/chongo/tech/comp/ansi_escapes.html



John
 
D

DennyTC4

Is the data in the same place everytime? Are the fields static? If so,
count and delte.
 
B

Benoit Lefebvre

Subject: removing ASCII escape chars from output
I have some output that looks like this
$B"+(B[21;32H1700$B"+(B[21;44HTC HUMATHROPE

There is only one ASCII escape character in there, *the* ASCII escape character. The other characters '[', '2', '1', ';', '3', '2', 'H', etc. are just normal ASCII characters.
and I am trying to extract the 1700 and HTC HUMATHROPE. Can someone
point me in the right direction?

You need to remove the ANSI escape sequences:

http://isthe.com/chongo/tech/comp/ansi_escapes.html

John

Because all the ANSI escape sequences are starting with \e[ and ending
with a letter.. Maybe he can do that with a regular expression

for example:
-------------------------
$myText = "$B"+(B[21;32H1700$B"+(B[21;44HTC HUMATHROPE";

$myText =~ s/\e\[[0-9\;]+[A-Za-z]//g;

print $myText. "\n";
-------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top