Remove WhiteSpce From Unix File

Every line in my file has this at the end: ^M

I used to know a command to remove this, but forgot.

Please assist.
deharvyAsked:
Who is Participating?
 
Raheman M. AbdulConnect With a Mentor Senior Infrastructure Support Analyst & Systems DeveloperCommented:
You can also try dos2unix command

dos2unix DOS-FILENAME filename

and then

mv filename DOS-FILENAME
0
 
Raheman M. AbdulConnect With a Mentor Senior Infrastructure Support Analyst & Systems DeveloperCommented:
cat FILENAME|sed "s/^M//g">File2
mv File2 File1
0
 
Raheman M. AbdulConnect With a Mentor Senior Infrastructure Support Analyst & Systems DeveloperCommented:
Another way within vi editor
Using sed command

sed 's:\^M::g' FILENAME

0
 
deharvyAuthor Commented:
dos2unix is the command I was thinking about. Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.