Remove the ^m symbol from the file in the Linux environment __linux

Source: Internet
Author: User

1. Sed-i-E ' s/^m$//' (filename) such as delete ^m character operation in a.php Sed-i-e ' s/^m$//' a.php

2. Grep-r "^m" a.php View the ' ^m ' character in the a.php file.

The first method:
Cat-a filename can see the faulted Meta characters under Windows ^m
To remove him, the simplest use of the following command:
Dos2unix filename

The second method:
Sed-i ' s/^m//g ' filename
#注意: ^m input is CTRL + V, then CTRL + M

The third method:
#vi filename
: 1,$ s/^m//g
^m Input Method: Ctrl + V, ctrl+m

The fourth method:
#cat filename |tr-d ' \ r ' > NewFile
#^m can be replaced with \ r

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.