\r \012 10 x0a return\n \015 13 x0d newline
In Unix systems, each line ends with only "<line feed>", that is, "\ n ";
In Windows, each line ends with "<press enter> <line feed>", that is, "\ r \ n ";
In Mac, each line ends with "<press enter> ".
One direct consequence is that if a file in UNIX/MAC is opened in windows, all the text will be changed to a line; if a file in Windows is opened in UNIX/MAC, A ^ m symbol may be added at the end of each line.
Lab 1:
Text that combines a line feed (\ n, 0x0a) and a carriage return (\ r, 0x0d ).
$ echo -en ‘12\n34\r56\n\r78\r\n‘ > tmp
View text in hexadecimal format
$ od -t x1 tmp0000000 31 32 0a 33 34 0d 35 36 0a 0d 37 38 0d 0a0000016
// 0000016, 8 in length
/R/n-> ^ m
/N/R-> line feed + ^ m
Different hexadecimal output file content
Od dump files in octal and other formats
Hexdump ASCII, decimal, hexadecimal, octal dump
Lab 2:
1. ^ m is '\ R' in ASCII, carriage return, 0x0d in hexadecimal notation, 015 in octal notation, and 13 in decimal notation.
^ M in the VI editor, you can press Ctrl + V + m to double-byte characters.
$ od -t x1 cc0000000 0d 0a0000002
2. directly input ^ m in VIM
$ od -t x1 dd0000000 5e 4d 0a0000003
\ R \ n carriage return Line Analysis