' \ R ' is a carriage return, the former makes the cursor to the beginning of the line (carriage return)
' \ n ' is a newline, which moves the cursor down one grid, (line feed)
\ r is the carriage return, return
\ n It's a newline, newline.
for line break this action:
under Unix, there is generally only one 0x0a that represents a newline ("\ n"),
windows is generally 0x0d and 0x0a two characters ("\ r \ n"),
Mac OS system uses a carriage return CR to indicate the next line (\ r)
Unix system, the end of each line only "< line >", that is "\ n";
Inside the Windows system, each line ends with "< enter >< wrap >", or "\ r \ n";
Mac system, the end of each line is "< Enter >", that is, "\ r".
A direct consequence of this is that if the file under the Unix/mac system is opened in Windows, all the text will be turned into one line, and if the file in Windows is opened under Unix, it will be more than a ^m character at the end of each line.
DOS and Windows with carriage return + newline CR/LF represents the next line, that is, ^m$ ($ is not a newline character, newline characters are not represented, $ is the representation of the end of text EOF)
Unix/linux uses the newline character LF to indicate the next line, \ n
The Mac OS system uses a carriage return CR to represent the next line, which is \ r
The CR symbol ' \ r ' indicates that the decimal ASCII code is 13 and the hexadecimal code is 0x0d;
LF using the ' \ n ' notation, the ASCII code is 10, and the 16 system is 0x0a. So the line breaks in the Windows platform are represented in a text file using 0d 0a two bytes, while the line breaks on UNIX and Apple platforms are expressed in 0a or 0d of a byte.
Because of the DOS style of the line to use \ r \ n, to upload such a file to UNIX, some versions of VI does not recognize \ r, so vi display at the end of the ^m will appear, but some can identify \ r \ n, normal display carriage return line.
About the line break, win and Mac implementations