The paste
utility merges corresponding or subsequent lines of files.
Questions tagged [paste]
135 questions
8
votes
1 answer
How to merge text file vertically?
Let's assume that I've got two text file a, b.
$cat a
a a
a a
a a
$cat b
b b
b b
b b
Then, I want to merge these two file vertically by using paste. The merged file is shown bellow
a a
a a
a a
b b
b b
b b
NOT
$paste a b > AB
$cat AB
a a b b
a a b…

comphys
- 319
8
votes
2 answers
How to paste output of multiple commands
I want to merge two unzipped files f1 and f2 in one command, like
paste (zcat f1.gz) (zcat f2.gz).
What is the right syntax?

user196711
- 181
4
votes
1 answer
Loop through files and join horizontally
I am trying to do the following:
Loop through a list of files
Edit each file and output a "trimmed" file
Horizontally join each trimmed file in turn to a pre-made master file
I have steps 1 & 2 working, but can't get 3 to work.
Example
MASTER…

Gaius Augustus
- 414
1
vote
0 answers
Removing ^M from shell script and realigning columns
I have a shell script that I am asking to print the columns I pasted together.
Then I'm asking it to realign the columns after its pasted and then take out the ^M character .
My code is
paste file1.1 file2.1 file3.1 > mega
column -t mega | tr -d…
1
vote
2 answers
how to paste several file together using a single space as a delimiter
These are 3 files:
file1 file2 file3
1 2 3 1 1 1 3 3 3
2 1 3 1 1 1 3 3 3
0 0 0 1 1 1 3 3 3
I want to join them together and have a final file like:
1 2 3 1 1 1 3 3 3
2 1 3 1 1 1 3 3 3
0 0 0 1 1 1 3 3 3
But when I use :
paste file1…

zara
- 1,313
0
votes
1 answer
Understanding the unix Paste command with input redirection
I am trying to understand the implementation of the paste command in unix when there is a file from input redirection.
Assuming the following files:
A.txt:
A
B
C
D
B.txt:
1
2
3
4
The unix command:
paste - A.txt - < B.txt
The expected output:
1 …

Iva l
- 1
0
votes
2 answers
Append file with two extra colums to a large table?
I need to paste two columns (in a file) to a very big file with an identical number of columns (length 48554). I have tried this
I have two files with columns separated by tabs. File 1 looks like this:
Header_1 header_2
0 23
1 25
and file 2 looks…
0
votes
0 answers
Merging two columns causes them to skip lines
I am trying to combine two text files each containing one column of numbers, I am using paste method to achieve this, but when I run my script it doesn't put them together correctly rather it skips a line and puts it in the opposide side. I checked…

user222776
- 103
0
votes
1 answer
adding columns to a file with same number of rows
I have a file like this naming it as file1
chr1 24018319 + a
chr1 24019249 + b
chr1 24020403 + c
chr1 24021281 + d
chr1 24022398 + e
chr1 45241272 + f
chr1 45241812 + g
chr1 45242446 + …

user3138373
- 2,559