0

Let's say I have a text file with the following:

1
3
5
7
9

and I want to paste the following to the right of it while still maintaining the spacing:

23 34 53 
22 17 99

(Of course I'm using many more numbers, so I can't just do this manually). So I want something like this:

1 23 34 53
3 22 17 99
5
7
9

How do I go about doing this?

1 Answer 1

3

You can use the paste command to merge columns from files as in:

f1:

1
3
5
7
9

f2:

23 34 53
22 17 99

Then the command paste f1 f2 will produce:

1 23 34 53
3 22 17 99
5
7
9

With a tab character between the portions pasted from each file unless you change the delimiter with the -d option.

You must log in to answer this question.