Latest web development tutorials

Linux paste Command

Linux command Daquan Linux command Daquan

Linux paste command column merge files.

paste command will each file listed in the manner of a column, a column to be merged.

grammar

paste [-s][-d <间隔字符>][--help][--version][文件...]

Parameters:

  • -d <space character> or --delimiters = <space character> characters with the specified replacement interval tab character.
  • -s or --serial tandem rather than be processed in parallel.
  • --help online help.
  • --version display help information.
  • File path [file ...] specified action

Examples

Use the paste command file "file", "testfile", "testfile1" merge, enter the following command:

paste file testfile testfile1 #合并指定文件的内容 

However, before executing the above command, the first to use "cat" command to view the contents of three documents, it appears as follows:

$ cat file                  #file文件的内容  
xiongdan 200  
lihaihui 233  
lymlrl 231  
$ cat testfile              #testfile文件的内容  
liangyuanm  ss  
$ cat testfile1             #testfile1文件的内容  
huanggai 56  
zhixi 73 

When combined instruction "$ paste file testfile testfile1" execution, the program interface will display the contents of the file after the merger, as follows:

xiongdan 200  
lihaihui 233  
lymlrl 231  
liangyuanm  ss  
huanggai 56  
zhixi 73  

If you use paste command parameter "-s", you can file a multi-line data as a single line display. For example, the file "file" in the third line of data as a single line of data is displayed, enter the following command

$ paste -s file             #合并指定文件的多行数据

After the above command is executed, the contents of the data displayed as follows:

xiongdan 200 lihaihui 233 lymlrl 231 

Note: The parameter "-s" just the contents of the file testfile adjust the display, and does not change the contents of the original file format.

Linux command Daquan Linux command Daquan