Ascall Code special characters--^m to remove files uploaded from Windows

Source: Internet
Author: User
Tags control characters

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 properly matched by regular expressions, Removing similar control characters is a necessary step to get these files back to normal use;

According to the Ascall character code table above, the left two columns of non-printing control characters show the Ascall code of each character, the next work is to match the regular expression with these characters and then remove the OK, remove the corresponding Ascall code characters, only need to escape the corresponding octal value can:

For example, to remove the carriage return control character, the binary value is 0b00001101, converted to octal: 015, as long as the s/\015//g can remove all the carriage return control characters.

At the same time, if you want to enter special control characters in VI, it should be in the Insert mode, control+v+control+m that is, enter the control character, the other control characters by similar input, Control+v+control+a input header start control characters, etc.

Ascall Code special characters--^m to remove files uploaded from Windows

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.