LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 09: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, 12:51 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

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



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 09:24 PM
supression of control characters in linux file pandunr Linux - Newbie 3 11-24-2011 10:37 AM
Clean Up Log - Search for Pattern in Log file and Output result bridrod Linux - Newbie 10 01-05-2010 09:49 AM
Viewing control characters in a text file dmorse Linux - General 2 01-06-2007 11:10 PM
How i can Clean up the log file of proxy? AZIMBD03 Red Hat 4 10-10-2003 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:55 PM.

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
Open Source Consulting | Domain Registration