[email protected] ~]# paste [-d] file1 file2
Options and Parameters:
-D: The delimiter character can be followed. The default is delimited by [tab]!
-: If the file section is written--indicates the meaning of the data from standard input.
Example one: Put/etc/passwd with/etc/shadow on the same line
[Email protected] ~]# Paste/etc/passwd/etc/shadow
Bin:x:1:1:bin:/bin:/sbin/nologin Bin:*:14126:0:99999:7:::
Daemon:x:2:2:daemon:/sbin:/sbin/nologin Daemon:*:14126:0:99999:7:::
Adm:x:3:4:adm:/var/adm:/sbin/nologin Adm:*:14126:0:99999:7:::
# Watch out! The middle of the same line is separated by the [tab] key!
Example two: first read the/etc/group (with cat) and then paste it together with the example! And only the first three rows are removed
[Email protected] ~]# Cat/etc/group|paste/etc/passwd/etc/shadow-|head-n 3
# The focus of this example is on that-the use! That stuff always stands for stdin Oh!
Example: Using CHPASSWD to bulk Modify user passwords
[[email protected] ~]# cat name
User1:
User2:
User3:
User4:
User5:
User6:
User7:
User8:
User9:
[[email protected] ~]# cat passwd
978ebbf1763
23c2626c37b
15dff03fa71
2459043B3AD
d317ec4870c
1728B6B5DDC
ed9d98f8b4c
0a7f3f5f8c4
96935ad635c
[[email Protected] ~]# paste name passwd
user1: 978ebbf1763
user2: 23c2626c37b
user3: 15dff03fa71
user4: 2459043b3ad
user5: d317ec4870c
user6: 1728B6B5DDC
user7: ed9d98f8b4c
user8: 0a7f3f5f8c4
user9: 96935ad635c
[[email protected] ~]# paste-d "#" name passwd
User1: #978ebbf1763
User2: #23c2626c37b
User3: #15dff03fa71
User4: #2459043b3ad
user5:# d317ec4870c
User6: #1728b6b5ddc
User7: #ed9d98f8b4c
User8: #0a7f3f5f8c4
User9: #96935ad635c
Note:-d Specifies the delimiter, without which the default is a tab.
Paste:linux merge columns from two files (merge left and right)