ohh do you want to remove M characters in UNIX ? Though i am not so good in UNIX but this time i had to get my hand dirty in UNIX.
Reasons were, there is no one to support things from UNIX perspective. And all of sudden I got 20+ UNIX scripts to work upon. You can imagine that what would have happened to me. I am in one among them who does not even like to see that raw black screen. It is a bizarre for me!!!!! This happens when you import files from MS-DOS to UNIX system and is a very common issue,
Objective of this post is to address below questions
- Why I am seeing ^M (control M ) character in UNIX file ?
- How to make my UNIX script \ file clean and without ^M (control M) character?
- What’s the best method to remove M characters or ( ^M ) from any UNIX file ?
Remove M Characters (^M) with Unix commands
Using dos2unix command
Using sed command
Remove M Characters (^M) with Unix Script
You can put above command in UNIX and it will do wonder as now you just have to give one parameter to that script. A script code is below and looks at the picture to understand that how it works.