September 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

September 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

How to merge contents of 2 files using paste?

This is one of the best command that facilitates the system admin to perform his specific tasks. Below is the list with the examples showing the paste command.

[localhost@localhost ~]$ cat file1
apple
orange
mango
banana

[localhost@localhost ~]$ cat file2
coldplay
westlife
michael
sunibigyana
piyush

[localhost@localhost ~]$ paste -s file1
apple orange mango banana

[localhost@localhost ~]$ paste -d, -s file1
apple,orange,mango,banana

[localhost@localhost ~]$ paste – – < file1 apple orange mango banana [localhost@localhost ~]$ paste -d':' - - < file1 apple:orange mango:banana [localhost@localhost ~]$ paste - - - < file1 apple orange mango banana [localhost@localhost ~]$ paste -d ':,' - - - < file1 apple:orange,mango banana:, [localhost@localhost ~]$ cat file2 coldplay westlife michael sunibigyana piyush [localhost@localhost ~]$ paste file1 file2 apple coldplay orange westlife mango michael banana sunibigyana piyush [localhost@localhost ~]$ paste -d, file1 file2 apple,coldplay orange,westlife mango,michael banana,sunibigyana ,piyush [localhost@localhost ~]$ cat file2 | paste -d, file1 - apple,coldplay orange,westlife mango,michael banana,sunibigyana ,piyush [localhost@localhost ~]$ cat file1 | paste -d, - file2 apple,coldplay orange,westlife mango,michael banana,sunibigyana ,piyush [localhost@localhost ~]$ cat file1 file2 | paste -d, - - apple,orange mango,banana coldplay,westlife michael,sunibigyana piyush, [localhost@localhost ~]$ paste -d'\n' file1 file2 apple coldplay orange westlife mango michael banana sunibigyana piyush [localhost@localhost ~]$

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>