Dos2unix, remove the ^m from the Linux file

Source: Internet
Author: User

A CPP file written by VS2010 is used under Windows, and you want to put it on Linux for compiling. Discover that each line of code in a file on Linux follows the ^m symbol at the end.

Why does the same file appear differently on Windows and on Linux? The original is due to the DOS editor and the Linux editor on the end of the file line of the carriage return processing inconsistency caused.

For a carriage return definition:
windows:0d0a
unixlinux:0a
mac:0d

Linux is dedicated to two tools that can be used interchangeably with Windows and Linux formats, respectively, Dos2unix and Unix2dos

So, how to remove the ^m at the end of each line of the file in Linux, you can use the following methods:

Execute command on terminal dos2unix filename

Dos2unix, remove the ^m from the Linux file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.