Remove the ^ M symbol from the Linux text file
In Linux, it is inevitable to use VIM to open some edited text files in Windows. We will find that there will be a ^ M symbol at the end of each line of the file, because the editor in DOS and the
Symptom: ^m appears when you open a text file that is edited by Windows under LinuxWhy: Move files from one system to another, and you'll encounter issues related to line breaks.Workaround:
Use regular expressions for full-text null
A CPP file written by VS2010 is used under Windows, and you want to put it on Linux for compiling. Discover that each line of code in a file on Linux follows the ^m symbol at the end.Why does the same file appear differently on Windows and on Linux?
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
Files edited on Windows if uploaded to Unix, at the end of each file there will be a newline control ^m, this character is generally hidden, unless cat-a can see, if not remove the symbol, many scripts do not work properly, many files can not be
Q: I pass a text file to Linux in Windows via FTP, but after opening the text file, each line has a ^m flag at the end. Because of the long, with the editor to remove too much trouble, what is the solution? A : In order to solve this problem,
Original URL: http://blog.csdn.net/kobejayandy/article/details/13291525Q: I pass a text file to Linux in Windows via FTP, but after opening the text file, each line has a ^m flag at the end. Because of the long, with the editor to remove too much
Q: I pass a text file to Linux in Windows via FTP, but after opening the text file, each line has a ^m flag at the end. Because of the long, with the editor to remove too much trouble, what is the solution?A: In order to solve this problem, Linux
1. Lock important system files
System O & M personnel may sometimes encounter situations where the root user cannot modify or delete a file. Most of the reasons may be that the file is locked. In Linux, the command for locking a file is chattr. You
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.