About the line and carriage return of text summary _ related skills

Source: Internet
Author: User

Before you say these two brothers, do an experiment first:

I create a new left text file Test.txt under Win7, and then open it in Notepad and enter the following to save

Then use UltraEdit to open in hexadecimal mode, as shown in the following figure

First, regardless of what you see above, open vim in Debian, enter the same content and save it as a Test.txt file.

Then enter the command in VIM:
:%!xxd

View the file in 16-way, as shown in the following illustration:

Okay, front. I'm putting two files hex code into the following handy for comparison:


Win7:6F 0D 0A 6F 62 65 32
Debian: 6F 0A to 6F to 0A

This time you see clearly, 0x0d said carriage return is ' \ R ', 0x0a means ' \ n '.

From the above results we can draw the following conclusions:

1. Under win, a "return key" means a combination of "\ r \ n", while under Linux, it means "\ n";

2. In both systems, the same document content is not necessarily the same size;

3. In Linux, each row will be in its last line line character, and win only in the real input enter key will insert "\ r \ n";

4. After you delete all the contents of the file under Vim, do you think the file is empty? Experiments have shown that it is not empty

Do you understand??? Welcome to pass ~ ~ ~
Refer to a useful article http://www.jb51.net/article/26547.htm
Original from: 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.