Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a Linux command like cat that joins files with the same number of lines horizontally?

share|improve this question

2 Answers 2

up vote 23 down vote accepted

paste may do the trick.

% cat t1 
a
b
c
c
d
f
g
% cat t2 
h
i
j
k
l
m
n
% paste t1 t2 
a       h
b       i
c       j
c       k
d       l
f       m
g       n

At least some of the time, you don't need to have a "key" to concatenate the lines.

share|improve this answer
2  
As seen in the example above, the default delimiter is TAB... For no delimiter: paste -d '\0' t1 t2 –  Peter.O Mar 11 '11 at 0:10

join should do the trick - You just need to prefix the lines with an identical ID.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.