How to paste columns from separate files using bash?

后端 未结 4 1776
醉酒成梦
醉酒成梦 2020-12-03 04:22

Using the following data:

$cat date1.csv
 Bob,2013-06-03T17:18:07
 James,2013-06-03T17:18:07
 Kevin,2013-06-03T17:18:07

$cat date2.csv
 2012-12-02T18:30:31
         


        
4条回答
  •  余生分开走
    2020-12-03 04:49

    Another way of doing it is with pr

    pr -mts, file1 file2
    

    Test:

    [jaypal:~/Temp] cat file1
    Bob,2013-06-03T17:18:07
    James,2013-06-03T17:18:07
    Kevin,2013-06-03T17:18:07
    
    [jaypal:~/Temp] cat file2
    2012-12-02T18:30:31
    2012-12-02T18:28:37
    2013-06-01T12:16:05
    
    [jaypal:~/Temp] pr -mts, file1 file2
    Bob,2013-06-03T17:18:07,2012-12-02T18:30:31
    James,2013-06-03T17:18:07,2012-12-02T18:28:37
    Kevin,2013-06-03T17:18:07,2013-06-01T12:16:05
    

提交回复
热议问题