Linux basic commands: dos2unix

dos2unix is ​​to convert the file format for the Windows command utility Unix, Linux format. Newline Windows file format for \ r \ n, and line breaks Unix & Linux file is \ n. Dos2unix command is actually the \ r \ n converted to \ n file.

The unix2dos is dos2unix each other and a twin command, which is to convert Linux & Unix file format for Windows file format commands.

 

Command syntax:

dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]

unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...]

 

Command parameters:

This command parameter is Red Hat Enterprise Linux Server release 5.7 dos2unix under the command parameters, different versions of Linux dos2nnix command parameters may be different.

parameter Long parameters description
-h   Dos2unix command displays online help information.
-k   Remain unchanged file timestamps
-q   Silent mode, does not output the conversion result information and the like
-v   Displays command version information
-c   Conversion mode
-O   In the source file conversion, default parameters
-n   Retain the original old files, the contents of the converted output to a new file. The default will be modified directly in the original file

 

Example of use: 

@ Ubuntu DSW: ~ / Work / dict $ LL 
Total 5592 
drwxrwxr-X 2 DSW DSW On Sep 30 4096 15:15 ./ 
drwxrwxr X-14 DSW DSW On Sep 30 4096 15:13 ../ 
-rwxr - r--. 1 dsw 2857196 Sep 30 15:15 dsw book.csv * 
-rwxr - r-- 1 dsw dsw 2857196 Sep 30 15:15 test.csv * 

dsw @ Ubuntu: ~ / Work / dict $ dos2unix book.csv // source converts this document based on the file format from dos to unix format 
dsw @ ubuntu: ~ / work / dict $ dos2unix -n book.csv newbook.csv // retain the source file 
dsw @ ubuntu: ~ / work / dict $ dos2unix book. csv book.csv // convert multiple files 
dsw @ ubuntu: ~ / work / dict $ dos2unix -k book.csv // does not change the converted file's time stamp 
dsw @ ubuntu: ~ / work / dict $ dos2unix -p book.csv // silent conversion

 

 
  

dos2unix is ​​to convert the file format for the Windows command utility Unix, Linux format. Newline Windows file format for \ r \ n, and line breaks Unix & Linux file is \ n. Dos2unix command is actually the \ r \ n converted to \ n file.

The unix2dos is dos2unix each other and a twin command, which is to convert Linux & Unix file format for Windows file format commands.

 

Command syntax:

dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]

unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...]

 

Command parameters:

This command parameter is Red Hat Enterprise Linux Server release 5.7 dos2unix under the command parameters, different versions of Linux dos2nnix command parameters may be different.

parameter Long parameters description
-h   Dos2unix command displays online help information.
-k   Remain unchanged file timestamps
-q   Silent mode, does not output the conversion result information and the like
-v   Displays command version information
-c   Conversion mode
-O   In the source file conversion, default parameters
-n   Retain the original old files, the contents of the converted output to a new file. The default will be modified directly in the original file

 

Example of use: 

@ Ubuntu DSW: ~ / Work / dict $ LL 
Total 5592 
drwxrwxr-X 2 DSW DSW On Sep 30 4096 15:15 ./ 
drwxrwxr X-14 DSW DSW On Sep 30 4096 15:13 ../ 
-rwxr - r--. 1 dsw 2857196 Sep 30 15:15 dsw book.csv * 
-rwxr - r-- 1 dsw dsw 2857196 Sep 30 15:15 test.csv * 

dsw @ Ubuntu: ~ / Work / dict $ dos2unix book.csv // source converts this document based on the file format from dos to unix format 
dsw @ ubuntu: ~ / work / dict $ dos2unix -n book.csv newbook.csv // retain the source file 
dsw @ ubuntu: ~ / work / dict $ dos2unix book. csv book.csv // convert multiple files 
dsw @ ubuntu: ~ / work / dict $ dos2unix -k book.csv // does not change the converted file's time stamp 
dsw @ ubuntu: ~ / work / dict $ dos2unix -p book.csv // silent conversion

 

Guess you like

Origin www.cnblogs.com/wzy23/p/11388780.html