Replace the ^ m character with vim

Source: Internet
Author: User
Original article output: Unknown ". There are several methods for processing. 1. Use the dos2unix command. This tool is included in the general distribution version (if not, you can download the tool based on the following connection). It is very convenient to use: $ dos2unix myfile.txt the command above will remove the ^ m at the end of the line. 2. Use the replacement function of VI. Start VI and enter the command mode. Enter the following command: % S/^ m $ // G # Remove ^ m at the end of the line. : % S/^ m // G # Remove all ^ m. : % S/^ m/[Ctrl-v] + [enter]/G # Replace ^ m with the carriage return. : % S/^ m/\ r/G # Replace ^ m with the carriage return. 3. Use the SED command. Similar to VI usage: $ sed-E's/^ m/\ n/G' myfile.txt Note: Here "^ m" is generated using the CTRL-V CTRL-M, instead of directly typing "^ m ".
Related Article

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.