Removing formats (bold) from UNIX file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Removing formats (bold) from UNIX file
# 1  
Old 01-08-2013
Error Removing formats (bold) from UNIX file

Hi ,

Could you please guide me how to remove formatting (bold text) in a unix file?

vi editor showing like this...
Code:
^[[1mtl21ss01^[[0m 
^[[1mtl21ss02^[[0m 
^[[1mtl21ss03^[[0m

Cat command showing like this...

Code:
tl21ss01 
tl21ss02 
tl21ss03 


Last edited by Scott; 01-08-2013 at 03:20 AM.. Reason: Code tags
# 2  
Old 01-08-2013
Code:
 awk -F"[" '{print $3}' <filename> | tr -d '1m' | tr -d '^'

If the data at the starting of the string wont change
# 3  
Old 01-08-2013
It is giving result like..
Code:
0 
0 
0

# 4  
Old 01-08-2013
try this..

Code:
 
perl -ne 's/\^.{1,7}?m//g;print' < input.txt > out.txt

# 5  
Old 01-08-2013
Code:
sed 's/.\[[01]m//g' infile

Code:
sed 's/.\[[0-9]\{1,\}m//g' infile


Last edited by Scrutinizer; 01-08-2013 at 03:47 AM..
# 6  
Old 01-08-2013
Try this too...

Code:
perl -ne 's/\e\[\d+m//g;print' < input.txt > output.txt


This User Gave Thanks to itkamaraj For This Post:
# 7  
Old 01-08-2013
Code:
perl -ne 's/\e\[\d+m//g;print' < input.txt > output.txt

IT IS WORKING.... THANK YOU ALL

Last edited by Franklin52; 01-08-2013 at 03:46 AM.. Reason: Please use code tags for data and code samples
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Slowly Removing Bold Font Style - Step-by-Step

FYI, I'm slowly removing a lot of the bold font-styles from titles of discussions, forum titles, etc I'm not removing bold for the entire site because we do need bold from time to time, especially in posts and sometimes in other places. However, the original forum style had way too much... (3 Replies)
Discussion started by: Neo
3 Replies

2. Shell Programming and Scripting

Make bold chars in UNIX

Hi all, I want to make the string as bold in unix. is there any way to acheive this? thanks in advance. (16 Replies)
Discussion started by: SekhaReddy
16 Replies

3. Shell Programming and Scripting

Need to check the file formats

Hi, I want to check the incoming files whether the file is Mac file or dos/windows file in unix shell script. Sometimes client is posting Mac file and sometimes it is dos file. Could you please help me how to determine/check whether the file is Mac or dos. Help in advance Thanks (4 Replies)
Discussion started by: lkeswar
4 Replies

4. Shell Programming and Scripting

Removing ^M from last line alone of a UNIX File

Hi All, I am copying a file from windows to UNIX. After that copying it have the ctrl+M character in the file at the line break. But the file contains the data that also have ctrl+M. I want to re move the ctrl+M at the end of the line alone. My file structure is XML and last line doesnt... (3 Replies)
Discussion started by: Agantrope
3 Replies

5. UNIX for Dummies Questions & Answers

What are the executable file formats in Solaris and Linux?

we all knew that .exe files are the executable file formats in windows....... Similarly, what are the executable file formats in solaris and linux ........ please tell me:D Thanks in Advance. (2 Replies)
Discussion started by: vamshigvk475
2 Replies

6. Shell Programming and Scripting

removing the words with symbols in a file in unix

I have file like below Hi iam author <br>joseph</br> in france. I live in my home <br></br> but no food. I will play footbal <br></br> but i wont play cricket. I will read all the books <br>all fiction stories</br> i hate horror stories. I want output like below Hi iam author... (3 Replies)
Discussion started by: vinothsekark
3 Replies

7. Shell Programming and Scripting

Removing Non-printable characters in unix file

Hi, We have a non printable character "®" in our file , we want to remove this character, we tried tr -dc '' < oldfile> newfile but this command is removing all new line entries along with the non printable character and all the records are coming in one line(it is changing the format of the... (2 Replies)
Discussion started by: pyaranoid
2 Replies

8. Shell Programming and Scripting

Removing the entire file contents using unix shell script.

I need to remove the entire file contents in file using the shell script. Actually the grap -v command will create one more file and it occupy the space also. I need to remove the entire file contents without creating new file using the shell scripting. Please help me. (5 Replies)
Discussion started by: praka
5 Replies
Login or Register to Ask a Question