When doing the experiment, the log redirection is written to the file for easy viewing later. But with vim opened after a lot of ^h and ^m, like garbled. :
Now try to solve this problem in vim.
Replace ^h
Enter a command in vim to replace the ^h with a space (note//with a space between)
:%s/^H/ /g
Explain:
s
: Represents a Replace operation
%
: "%": indicates the entire file. The symbol in front of s indicates the scope of the search, and the current line is omitted. such as: "1,20": means from line 1th to 20;
/
: delimiter, separating the source and target characters that need to be replaced, and the command
^H
: Need to replace the content, this is a control character. ^h Input Method: Hold down the CTRL key first, then click the Letter V and the character H to complete the input
Replace ^m
:%s/^M/\r/g
^M
: is a carriage return line break in a DOS system
\r
: \ is an escape character, \ r denotes a line break under Linux
Similarly, the input method of ^m: Hold down the CTRL key first, then click the Letter V and the character M
Working with ^h and ^m in the redirect file in Vim