Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-04-2016, 10:57 PM   #1
LQ Newbie
Registered: Mar 2007
Location: Bangalore
Posts: 3

Rep: Reputation: 0
Unable to clean ^[(B control characters from log file

Hello All,

I am trying to clean all color control characters from log file. I am able to clean all other control characters except ^[(B . Please help me to clean this control character also.

I am using these combination to clean control characters.

cat $LOGFILE | sed -e 's/\x1b\[[0-9;]*m//g' > $LOGDIR/Temp.txt

Old 06-05-2016, 01:51 AM   #2
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 770
Blog Entries: 3

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
Here's a quick (and slightly dirty) variant in sed:
echo "^[(B" | sed 's/\^\[.B//'
Old 06-05-2016, 01:56 PM   #3
LQ Newbie
Registered: Mar 2007
Location: Bangalore
Posts: 3

Original Poster
Rep: Reputation: 0
I got best solution so far to remove any control characters.

sed -e 's/\x1b\(\[[0-9;]*m\|(B\)//g'

I tested and it worked perfect.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Control Characters from a File NeonFlash Linux - Newbie 3 02-04-2013 10:24 PM
supression of control characters in linux file pandunr Linux - Newbie 3 11-24-2011 11:37 AM
Clean Up Log - Search for Pattern in Log file and Output result bridrod Linux - Newbie 10 01-05-2010 10:49 AM
Viewing control characters in a text file dmorse Linux - General 2 01-07-2007 12:10 AM
How i can Clean up the log file of proxy? AZIMBD03 Red Hat 4 10-10-2003 09:27 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:23 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration