1

For example if I have file A:

s  
s  
s  
s  
s  

And file B:

d  
d  
d  
d  
d  

How do I make file C:

s d  
s d  
s d  
s d  
s d   

I have been trying to use sed, awk, and xargs but to no success. I'm using bash on a mac.

steeldriver
  • 78,509
  • 12
  • 109
  • 152
  • 5
    Does this answer your question? [How to interleave the lines of two or more files?](https://unix.stackexchange.com/questions/140563/how-to-interleave-the-lines-of-two-or-more-files) – thanasisp Oct 28 '20 at 04:08

2 Answers2

1

Either

paste -d ' ' A B > C

or

pr -Tm -s' ' A B > C

You can remove the delimiter specifications (-d ' ' and -s' ' respectively) if you don't mind the default (tab) delimiters.

steeldriver
  • 78,509
  • 12
  • 109
  • 152
0

Will paste work for you?

paste A B > C

It is extremely fast.

Ole Tange
  • 33,591
  • 31
  • 102
  • 198