Article Title: Make DOS compatible with Unix files. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Unix and DOS (including ipvs) are different types of operating systems. Different Internal architectures make the files between them difficult to be compatible with each other. If there is a text file, the content is as follows:
If the file is in Unix format, it will not be displayed normally in Windows. It is very likely that when enabled in Windows, the three lines will be displayed in the same line. Therefore, if there are Unix and Microsoft Operating Systems in the enterprise, you need to consider how to improve file compatibility. Not only must the file content be displayed, but the file format also needs to be saved, such as a branch. Today, I will discuss this issue with you.
I. Main differences between Unix files and Dos Files.
In practice, System Engineers often need to share files between Unix and Windows operating systems. However, because of the differences in their formats, the compatibility is not very high. Understanding the specific differences in their formats is a prerequisite for solving this compatibility problem. In fact, there are few differences between them, but there is a little difference in a semicolon controller. For example, the author creates a test file in the Unix and Windows operating systems respectively. Then use od? Bc test (files in Unix operating systems) and od-bc test. the two commands test (a text file in the Microsoft operating system) show the two files, so their differences will be at a glance.
Test1
Test2
Unix test
In Microsoft operating system files (such as NotePad files), the line terminator must be expressed with two characters, namely, \ r and \ n. However, for files in Unix operating systems, the row Terminator is represented by only one character, that is, \ n. the octal values of \ r and \ n are 015 and 012 respectively. \ r and \ n are escape characters. Use od? The bc command can display the result in octal. If you want to convert the Dos file format to the Unix file format, you need to remove more than one \ n symbol behind each line. To convert a Unix file to a format supported by the Microsoft operating system, add the \ n symbol to the end of each line. This principle is simple, but it is difficult to operate. If the content is small, manual changes do not work much. However, if a file contains hundreds of lines and thousands of lines, manual modification is not a good idea. Therefore, you need to use certain tools or commands to implement this automatic conversion function.
Use od? The bc command can display the result in octal format. In actual work, gossip has great practical value for System Engineers. Why? This should begin with the octal mechanism. The so-called octal is that the base number is 8, and the base value can be 0, 1, 2, 3, 4, 5, 6, 7, a total of 8 values, every eight into one. The octal format is the same as the decimal format. So why do we need to do this in October? In fact, octal references are mainly used to facilitate writing and representation, because binary represents a long number of digits. For example, the number 10 is expressed as (, 10000000000, and a total of 11 digits. The value is 8 in octal format. More importantly, because binary and octal are in a peering relationship, each three-digit binary is exactly the same as the octal number. Therefore, binary and octal have no difference in operation, but decimal does not have this advantage. The most important thing is that the operating system uses binary representation. Because the binary and decimal values are completely equivalent, System Engineers sometimes prefer to use octal to display the results. To improve the business level, System Engineers need to learn more about the display format and operation logic of octal.
[1] [2] [3] [4] Next page