Code Snippets & Stripping ANSI Escape Sequences
Posted: 09 May 2015, 16:29
Got solution for Stripping ANSI Escape Sequences from http://www.commandlinefu.com/commands/v ... ed#comment , on an interesting site facilitating saving and sharing code snippets in the Cloud.
Solution chosen was sed "s,\x1B\[[0-9;]*[a-zA-Z],,g". This did not however do a complete job in the case of:which was spattered with escape sequences, all of which were removed except for 'ESC(B' at end of line.
Another sed line had to be added to complete the solution for this particular file:
Info: ANSI Escape Sequences in Shell Scripts
Solution chosen was sed "s,\x1B\[[0-9;]*[a-zA-Z],,g". This did not however do a complete job in the case of:
Code: Select all
root@porteus:/home/guest# usm -g babl 2>&1 | tee -a ue
guest@porteus:~$ less ue
Another sed line had to be added to complete the solution for this particular file:
Code: Select all
guest@porteus:~$ sed "s,\x1B\[[0-9;]*[a-zA-Z],,g
> s/\x1b(B$//" ue > ut
guest@porteus:~$ less ut