Linux paste command
Translation results:
paste
英[peɪst] 美[pest]
n.Dough; paste; meat (or fish, etc.) sauce (for spread or cooking) ); (for making artificial gemstones) lead glass
vt. Paste, post; cover with... on
Third person singular: pastes Plural: pastes Present participle: pasting Past tense: pasted
Linux paste commandsyntax
Function: The paste command is used to merge columns of files. The paste command will merge each file column-by-column.
Syntax: paste [-s][-d <spacing character>][--help][--version][file...]
Linux paste commandexample
Use the paste command to merge the files "file", "testfile", and "testfile1" and enter the following command:
paste file testfile testfile1 #合并指定文件的内容
However, before executing the above command, first use the "cat" command to merge the 3 files. Check the content of the file, and the display is as follows:
$ cat file #file文件的内容 xiongdan 200 lihaihui 233 lymlrl 231 $ cat testfile
#The content of the testfile file liangyuanm ss
$ cat testfile1 #testfile1文件的内容 huanggai 56 zhixi 73
When the merge command "$ paste file testfile testfile1" is executed, the program interface The merged file contents will be displayed as follows:
xiongdan 200 lihaihui 233 lymlrl 231 liangyuanm ss huanggai 56 zhixi 73
If you use the parameter "-s" of the paste command, you can merge multiple lines of data in a file into one line for display. For example, to merge three lines of data in the file "file" into one line of data for display, enter the following command
$ paste -s file #合并指定文件的多行数据
After the above command is executed, the displayed data content is as follows:
xiongdan 200 lihaihui 233 lymlrl 231