0

This question already has an answer here:

I have three CSV files which have the same same row count.

1.csv
1,2,3
4,5,6
7,8,9

2.csv
4
5
6

3.csv
8
9
10

After combining I want the result as

result.csv
1,2,3,4,8
4,5,6,5,9
7,8,9,6,10

So I tried with

paste 1.csv 2.csv | tr "\t" "," > intermediate.csv
paste intermediate.csv 3.csv | tr "\t" "," > result.csv

But I got result like

 result.csv
    1,2,3, 4,8
    4,5,6, 5,9
    7,8,9, 6,10

marked as duplicate by don_crissti, GAD3R, Anthon, sam, Toby Speight Dec 6 '16 at 20:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6

Try this:

paste -d, 1.csv 2.csv 3.csv > result.csv

The -d flag sets the delimiter so you don't have to attempt to clobber the tabs with tr.

Not the answer you're looking for? Browse other questions tagged or ask your own question.