Dense.mode February 2016

remove this string ^[[38;1H^[[K^[[7m71%^[[27m^[[38;1H^[[38;1H^[[K

I am trying to remove from a text file the following string as displayed by vim

^[[38;1H^[[K^[[7m71%^[[27m^[[38;1H^[[38;1H^[[K

in this text files i have 7m1000 entries meaning

^[[38;1H^[[K^[[7m71%^[[27m^[[38;1H^[[38;1H^[[K ^[[38;1H^[[K^[[7m72%^[[27m^[[38;1H^[[38;1H^[[K ^[[38;1H^[[K^[[7m73%^[[27m^[[38;1H^[[38;1H^[[K ... ^[[38;1H^[[K^[[7m1000%^[[27m^[[38;1H^[[38;1H^[[K

I tried with cat/grep/sed..

I tried with the following script

def Process(data):
 text = data.split()[0]
 #print repr(text)
 text = re.sub('[%s]' % re.escape(string.punctuation), '', text)
 data.split()[0]= text
 return data

Producing

:python Clo.py
IP:     138.42.153.194->10.132.136.42, protocol 6, [38;1H[K[7m86%[27m[38;1H[38;1H[KTCP:    sport 3389, dport 58187, seq 978549389, ack 33554488, flags 0x0018 ( ACK PSH), urgent data 0, Flow fastpath, session 911218, wqe index 487973 packet 0x0x80000000416988e6,  Packet info: len 107 port 17 interface 17 vsys 0, Packet from interface 256 forwarded to DP0 for tunnel encap

would it be possible to remove ["'\x1b[38;1H\x1b[K\x1b[7m######%\x1b[27m\x1b[38;1H\x1b[38;1H\x1b[KTCP:] directly from VI?

Answers


Dense.mode February 2016

the solution for me was

:%s/^[.*^[//g

Post Status

Asked in February 2016
Viewed 1,752 times
Voted 4
Answered 1 times

Search




Leave an answer