I have two parallel files with the same number of lines in two languages and plan to merge these two files line by line with the delimiter |||
. E.g., the two files are as follows:
File A:
1Mo 1,1 I love you.
1Mo 1,2 I like you.
Hi 1,3 I am hungry.
Hi 1,4 I am foolish.
File B:
1Mo 1,1 Ich liebe dich.
1Mo 1,2 Ich mag dich.
Hi 1,3 Ich habe Durst.
Hi 1,4 Ich bin neu.
The expected output is like this:
1Mo 1,1 I love you. ||| 1Mo 1,1 Ich liebe dich.
1Mo 1,2 I like you. ||| 1Mo 1,2 Ich mag dich.
Hi 1,3 I am hungry. ||| Hi 1,3 Ich habe Durst.
Hi 1,4 I am foolish. ||| Hi 1,4 Ich bin neu.
I tried the paste
command such as:
paste -d "|||" fileA fileB
But the returned output is only containing one pipe such as:
1Mo 1,1 I love you. |1Mo 1,1 Ich liebe dich.
1Mo 1,2 I like you. |1Mo 1,2 Ich mag dich.
Is there any way to separate each pair of lines by tripe pipe |||
?
paste -d '|||' fileA - - fileB < /dev/null
– Stéphane Chazelas Nov 23 '15 at 10:25