1. Command function
paste is used to merge columns of files, merging each file column by column, column by column.
2. Grammar format
paste option file
parameter options
parameter |
Parameter Description |
-d |
Specify the space to merge the files (the default is a space as the spacer) |
-s |
Merge files one at a time (serial processing instead of parallel processing) |
3. Example of use
Ready to work
[root@localhost test]# cat test1 123456 789100 112233 445566 [root@localhost test]# cat test2 abcdef ghilmn aabbcc ddeeff
Example 1 Merge files
[root@localhost test]# paste test1 test2 123456 abcdef 789100 ghilmn 112233 aabbcc 445566 ddeeff
Example 2 Merge files by asterisk (*)
[root@localhost test]# paste -d "*" test1 test2 123456*abcdef 789100 * ghilmn 112233*aabbcc 445566 * ddeeff
Example 3 -s parameter usage
[root@localhost test]# paste -s test2 abcdef ghilmn aabbcc ddeeff [root@localhost test]# paste -s test2 test1 abcdef ghilmn aabbcc ddeeff 123456 789100 112233 445566 [root@localhost test]# paste -d "^" -s test2 test1 abcdef^ghilmn^aabbcc^ddeeff 123456^789100^112233^445566