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