how to delete M-^M characters from a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to delete M-^M characters from a file
# 1  
Old 11-20-2008
how to delete M-^M characters from a file

I am receiving a file with 'M-^M' characters...how do I get rid of these characters.
I tried tr -d '\015' and sed '/^M//g', but they didnot work.

Appreciate if someone can help me with this
# 2  
Old 11-20-2008
Hammer & Screwdriver

Take a look at this thread
https://www.unix.com/shell-programmin...character.html

Also, search this forum for the dos2unix utility.
DOS uses CR (carriage return) and LF (line feed) between rows, while
Unix uses LF only.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Need help to delete special characters exists only at the end of the each record in UNIX file?

Hi, I have a file in unix with 15 columns.It consists special characters(#,$,^M,@,*,% etc)at the end of the each record.I want to remove these special characters.I used the following: Sed -e 's/ /g;s/ */ /g' . But It is removing special characters exists everywhere in the file(begining,middle... (24 Replies)
Discussion started by: rakeshp
24 Replies

2. Shell Programming and Scripting

need to Delete first 10 characters of a file name

Hello Everyone, I need help in deleting first 10 characters from the filename in a directory eg: 1234567890samplefile1.txt 1234567890samplefile2.txt and so on.. need to get the output as samplefile1.txt Thanks in Advance!!!! (8 Replies)
Discussion started by: Olivia
8 Replies

3. Shell Programming and Scripting

how to delete special characters from the file content

Hello Team, Any one suggest how to delte the below special character from a file which is having one column 10 rows of same below content. ---------------------------------------- Kosten|bersicht gemd_ ' =Welche Kosten kvnnen... (2 Replies)
Discussion started by: kanakaraju
2 Replies

4. UNIX for Dummies Questions & Answers

Vim help - delete words in a file or characters after pattern

I have a file with words that begin with character #. Whenver that character is found that word should be deleted throughout the file. How do I do that in VIM. e.g: afkajfa ladfa ljafa #222222 kjafad ljl afajkj kjlj uouu #44444 jlkj lkjl Output should be afkajfa ladfa ljafa kjafad... (1 Reply)
Discussion started by: osbourneric
1 Replies

5. Shell Programming and Scripting

Delete new line characters from a file

Hi, I have a file with about 25 colums separated with '~', but few of the lines have extra tabs ('^') and new line characters ('$'). Is there a way I can delete those characters if they are anywhere before the 25th column in a line? example: CLUB000650;12345678;0087788667;NOOP MEMBER ... (4 Replies)
Discussion started by: rudoraj
4 Replies

6. Shell Programming and Scripting

How to delete characters using a file

Hi All, I have a configuration file (file.cfg) in which data will be like this ; , _ + a to z A to Z Now i have to read a textfile (file.txt) and i need to check whether there is any other character present in text file that is not existing in (file.cfg). If other characters are present... (4 Replies)
Discussion started by: krishna_gnv
4 Replies

7. Shell Programming and Scripting

Delete not readable characters

Hi All, I wanted to delete all the unwanted characters in the string. ie, to delete all the characters which are not alpha numeric values. var1="a./bc" var2='abc/\."123' like to get the output as print var1 abc print var2 abc123 Could you guys help me out pls. Your help is... (3 Replies)
Discussion started by: ajilesh
3 Replies

8. UNIX for Dummies Questions & Answers

delete non printable characters from file

i have a file which contains non printable characters like enter,escape etc i want to delete them from the file (2 Replies)
Discussion started by: alokjyotibal
2 Replies

9. UNIX for Dummies Questions & Answers

How to delete a file with special characters

I don't now exactly how I did it, but I created a file named " -C " cexdi:/home1 $ls -lt total 1801336 -rw------- 1 cexdi ced-group 922275840 23 mars 10:03 -C How do I delete this file ? cexdi:/home1 $rm -C rm: invalid option -- C Syntax : rm filename ... Doesn't work...... (5 Replies)
Discussion started by: yveslagace
5 Replies

10. Programming

how to insert and delete characters in the middle of file

I have a problem that I want to insert and delete some chars in the middle of a file. fopen() and fdopen() just allow to append at the end. Is there any simple method or existing library that allow these actions? Thanks in advance.:confused: (7 Replies)
Discussion started by: ivancheung
7 Replies
Login or Register to Ask a Question