The documentation written in Notepad under Linux doc Windows differs from those written by Vim or gedit under Linux! For example, the SH script written under Windows can be executed under Linux and may go wrong. Workaround: The reason is: Windows line break symbol is "\ r \ n", and Linux is "\ nthe" no "\ R", when the shell file is written under Windows, all the newline characters are "\ r \ n", the shell is not able to execute the file, The above error is indicated. Under UltraEdit, execute the file->conversions->Dos to Unix, this converted sh file can be executed directly under Linux. This can be done by canceling the "\ r" symbol. Select ASCII on the client side. If you have completed transfer with binary, try it: Cat Ms.txt| Col-b >linux.txt Linux New documents opened in Notepad under Windows will be squeezed together (without newline characters) because Notepad does not support \ n line wrapping (it only supports \ r \ n form of line break), the workaround: Save the DOC format to open with Word, This creates a new doc document (which belongs to a plain-text doc document) with VIM or gedit under Linux (or a new. C document, which can be browsed in Windows with VC6.0!). )。 To open it, you can also enter the command directly: (Note that if the file name is Chinese, it may not be found, you need LS, then copy the file name, and then gedit paste the file name) Gedit Xx.doc or Vim Xx.doc (not recommended, VIM may not support traditional Chinese characters) or directly find the file, click, Open Office, select Character Set (System), character (SYSong18030), Language (English), change the paragraph:1. cr&LF, that is, \ r \ n, this is the format of Notepad under Windows, Linux is fully supported; (recommended)2. CR, that is \ r, Notepad does not support, no line-wrapping effect, there is no \ r effect; Word has a line-break effect, there is a \ r, the \ R effect is: At the end of each line, the default cursor positioning is the beginning of the next line, that is, the line at the end of the input is actually the beginning of and \ n is the carriage return, originally the typewriter paper moves down one, later in linux/Unix system, \ n becomes the actual line break. 3. LF, i.e. \n,linux/line break under UNIX systems. If it is a doc document written under Windows, it is generally garbled to view (with open Office) under Linux, and the workaround is to use Open Office first, then select All, and set the font to Sysong18030,ok Chinese Simplified and traditional are displayed as normal. \ r is a carriage return, \ n is a newline character, the line-break flag for each system: win with \r\nlinux/\RCR symbols for Unix with \nmac OS'\ r'indicates that the decimal ASCII code is 13, and the hexadecimal code is used for OXODLF'\ n'The symbol indicates that the ASCII code is 10, 16 is 0x0a so Windows uses oaod, that is, CR&Lf,linux/Unix is used OA, that is, lfmacos with OD, that is, the CR Origin: Before the computer has appeared, there is a kind of called the Telex typewriter (teletype Model -), you can play 10 characters per second. But it has a problem, that is, when the line is finished, it will take 0.2 seconds to hit two characters. If there are new characters coming in this 0.2 seconds, then this character will be lost. So, the developers think of a way to solve this problem, is to add two after each line to end the character. One is called "carriage return", which tells the typewriter to position the printhead at the left border, and the other is called "line break", telling the typewriter to move the paper down one line. This is the origin of "line break" and "carriage return", from their English name can also be seen in one or two. Later, the computer invented, these two concepts are also like to the computer. At that time, memory was expensive, and some scientists thought it would be too wasteful to add two characters at the end of each line. So, there was a disagreement. Unix system, each line ends with only "< line > "," \ n ", in Windows system, the end of each line is" < Enter >< line > ", that is," \ r \ n ", the end of each line in the Mac system is" < Enter > ". 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/mac, there may be an extra ^ at the end of each line.m symbol. (When using FTP software to transfer files between different platforms, some FTP client programs automatically convert to line format in ASCII text mode transfer mode.) The number of file bytes passed through this transfer may vary. If you do not want FTP to modify the original file, you can use bin mode (binary mode) to transfer the text \ n and \ r in the C language usage: #include<stdio.h>intMain () {printf ("938517\r10086\n"); return 0;} Whether it's a Linux system or a Windows platform, the inputs are10086because \ r has already been changed, so 938517 is no longer displayed. and \ n is not really a newline, it actually moves the paper (or screen) down one (to show the next line of content). http://blog.csdn.net/zollty/article/details/6771858
Line breaks under Linux \n\r and the use of TXT and Word documents