Reprint VI replace Windows line break with Linux newline character

Source: Internet
Author: User

1. Open the specified text file with VI: VI filename.c

2. Press the ESC key to enter the command mode;

3. Press: Key (press Shift key, press: Key at the same time) enter the command input state;

4. After the colon, enter:%s/^m//g

Note: ^m is a character that is not input ^ and m two characters,

That is, hold down the CTRL key and press the V key to generate ^, still hold the CTRL key, and press M to produce m.

5. Press the Enter key to execute the Replace command

6. Press: Key (press Shift key, press: Key) to enter the command input state;

7. After the colon enter: Wq <--Save changes

8. Press the Enter key to execute the Save command

File encoding method and line terminator settings in the IDE:

1) in the VS2008 under Window,

Click the menu [file]->[advanced Save Options ...],

In the Advanced Save Options dialog box that pops up,

Set Encoding to Unicode (UTF-8 with signature)-Codepage 65001

Set line endings to Unix (LF)

2) in the code::blocks under Ubuntu,

Click on the menu [Settings]->[editor ...],

In the "Configure Editor" dialog box that pops up,

Click the General Settings option in the left-hand box

Set the Encoding in the Options group

Use encoding when opening files is UTF-8

Use this encoding as default encoding (bypassing C::b ' s auto-detection)

In the End-of-line Options group, set the

End-of-line MODE:LF

Reprint VI replace Windows line break with Linux newline character

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.