Junk Character in file

Hi

set filename "./GopiRun.sh"

if [catch {set a [exec $filename ]} err] {
writeLog "error in exec "
writeLog $a
} else {
writeLog $a
}

The above code will execute a file GopiRun.sh,and will log the output of the exec to a file.
The problem is the file has lot of junk character in it,how to avoid it.
The file

^[[34mFly me to the moon...^[[0m
^[[0mLOG PATH:^[[0m ^[[0m/net/rita/disk1/disk3/ADVA/sw/nesw-F7/users/gopik/swbes/dev_tools/Test_F7/Twisted/internal_trace/^[[0m
^[[0m^[[1;34m Log log_name_2008_03_27_10.51.43__7851 is written in /net/rita/disk1/disk3/ADVA/sw/nesw-F7/users/gopik/log/ ^[[0m
^[[0mLOG PATH:^[[0m ^[[0m/net/rita/disk1/disk3/ADVA/sw/nesw-F7/users/gopik/swbes/dev_tools/Test_F7/Twisted/internal_trace/^[[0m
^[[0m^[[31mSSH Shell Connection Made^[[0m
^[[0msend: 'ps aux | grep tcli'^[[0m
^[[0mStarting tcli^[[0m
^[[0msend: 'tcli &'^[[0m
^[[0mLOG PATH:^[[0m ^[[0m/net/rita/disk1/disk3/ADVA/sw/nesw-F7/users/gopik/swbes/dev_tools/Test_F7/Twisted/internal_trace/^[[0m
^[[0m^[[31mTCLI Connection Made^[[0m
^[[0mSetting the Default client^[[0m
^[[0mClient is created^[[0m
^[[0mForce Destroy ^[[0m
^[[0mFORCEDESTROY:MOD-1-1;^[[0m
^[[0m COMPLD
RC_NOERROR
^[[0m
^[[0mGET::MOD-1-1:ADMIN;^[[0m
^[[0m COMPLD

I can't help you with the TCL but if you can wrap or modify the shell script to trim the color codes, you might use something like sed 's/^[\[[^m]*m//' where the ^[ right at the beginning needs to be a literal escape (hex 0x1B) character. Also you might want to check if there are codes which do not begin with escape, open square bracket and end with m, but I didn't spot any in your sample output.

How to i write a script to achive the above...