LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-04-2016, 10:57 PM   #1
apskaushik
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

Thanks
Amit
 
Old 06-05-2016, 01:51 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 754
Blog Entries: 3

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Here's a quick (and slightly dirty) variant in sed:
Code:
echo "^[(B" | sed 's/\^\[.B//'
Best,
HMW
 
Old 06-05-2016, 01:56 PM   #3
apskaushik
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.
 
  


Reply


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


All times are GMT -5. The time now is 03:38 AM.

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