Skip to content
Advertisement

Linux or Mac: merging columns from different files mixes the columns

I am trying to use “paste” command to merge columns from few files but it makes a bad merge as follows. I appreciate your help.

File1.csv:

A   2

B   3

C   4

File2.csv:

AA   6

BB   8

CC   2

output expected(required):

A 2 AA 6

B 3 BB 8

C 4 CC 2

The command I used:

paste File1.csv File2.csv > output.csv

also used

paste -d't' File1.csv File2.csv > output.csv

output.csv(wrong output that I get):

A  2
  AA  6

B  3
  BB  8

C  4
  CC  2

Thanks. I appreciate your help.

Advertisement

Answer

@shellter solution worked very well which is using ‘dos2unix’ command.

dos2unix file1 file2 file3 fileN
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement