The paste command merges each file in a column-to-column manner.
Syntax
Paste [-s] [-d <delimiter>] [-- help] [-- version] [file...]
Parameters:
-
-D <delimiter> or -- delimiters = <delimiter> replace the delimiter with the specified delimiter.
-
-S or -- serial string columns are processed rather than in parallel.
-
-- Help online help.
-
-- Version: displays help information.
-
[File…] File path of the specified operation
Instance
Use the paste command to merge files "file", "testfile", and "testfile1". Enter the following command:
Paste file testfile testfile1 # merge the content of a specified file
However, before executing the preceding commands, run the "cat" command to view the content of the three files, as shown below:
$ Cat file # file content xiongdan 200 lihaihui 233 lymlrl 231 $ cat testfile # content of the testfile liangyuanm ss $ cat testfile1 # content of the testfile1 file huanggai 56 zhixi 73
After the merge command "$ paste file testfile testfile1" is executed, the merged file content is displayed on the program interface, as shown below:
Xiongdan 200 lihaihui 233 lymlrl 231 liangyuanm ss huanggai 56 zhixi 73
If you use the paste command parameter "-s", you can combine multiple rows of data in a file into one row for display. For example, to merge the three data lines in the file into one row for display, enter the following command:
$ Paste-s file # Merge multiple rows of data in a specified file
The data displayed after the preceding command is executed is as follows:
Xiongdan 200 lihaihui 233 lymlrl 231
Note: The "-s" parameter only adjusts the display mode of the content of the testfile and does not change the content format of the original file.