Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paste two text lists (one list a file) into one list separated by semicolon

An example of the process/output would be:

File1:

hello
world

File2:

foo
bar

Resulting file after concatenation:

File3:

hello;foo
world;bar

For a large list of non-predictive text (no-wild cards - but lines are aligned as above).

I cannot figure out how to do this with the paste command under Ubuntu.

like image 340
user191960 Avatar asked Oct 18 '09 10:10

user191960


2 Answers

paste -d';' File1 File2  >  File3
like image 125
mouviciel Avatar answered Sep 21 '22 00:09

mouviciel


cat concatenates by lines (or, more accurately, doesn't care what the contents are).

What you seem to need is something more like paste.

$ paste -d\; file1 file2
hello;foo
world;bar
like image 39
JB. Avatar answered Sep 19 '22 00:09

JB.