Text Summary of line breaks and carriage return

Source: Internet
Author: User

Before talking about these two brothers, we should first conduct an experiment:

Create a new test.txt file in win7and use NotePad to open the following content and save it.

Use ultraedit to enable it in hexadecimal format, as shown in figure

Check the content first, and open vimin Debian. input the content of the same sample and save it as the test.txt file.

Then input the following command in VIM:
: %! Xxd

View the file in hexadecimal format, as shown in:

Okay, I have two files in hexadecimal format on the front.CodePost below for comparison:


Win7: 53 6f 62 65 31 0d 0a 73 6f 62 65 32
Debian: 53 6f 62 65 31 0a 73 6f 62 65 32 0a

Now you can see it clearly. 0x0d indicates that the carriage return is '\ R', and 0x0a indicates that the line feed is' \ n'

From the above results, we can draw the following conclusions:

1. In Win, a [enter key] means entering a combination like \ r \ n. in Linux, it means inputting '\ n ';

2. In these two systems, the same file content is not necessarily in the same size;

3. in Linux, line breaks are added at the end of each line, while in win, "\ r \ n" is inserted only when the Enter key is entered ";

4. After deleting all the file content in Vim, do you think the file is empty? The experiment proves that it is not empty.

Do you understand ??? Thank you for choosing ~~~
Reference a usefulArticleHttp://www.jb51.net/article/26547.htm
Source: cnblogs sobe

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.