João Nunes
João Nunes

Reputation: 1

UNIX iterating through .txt files and merge them by line into a single file

Suppose I have 3 different .txt files on UNIX shell. I want to merge the different files into a single one. I also need that file to be created and written line by line.

Take the following example:

file1.txt:

-abc

-def

-ghi

file2.txt:

-123

-456

-789

file3.txt:

-***

-^^^

-´´´

And I need the combinedFile to be writen and saved in this format:

combinedFile.txt

abc 123 ***

def 456 ^^^

ghi 789 ´´´

Upvotes: 0

Views: 28

Answers (1)

xenoson
xenoson

Reputation: 163

cut, example:

cut -d- -f2 file1 > file11

paste, example:

paste -d' ' file11 file22 file33

Upvotes: 1

Related Questions