Merge two files in linux with different column

后端 未结 4 704
野趣味
野趣味 2020-12-28 08:58

I have two files in linux, the first file has 4 columns and the second has 2 columns. I want to merge these files into a new file that has the first 3 columns from file 1 an

4条回答
  •  不思量自难忘°
    2020-12-28 09:06

    Not sure which columns you want from each file, but something like this should work:

    paste   | awk '{print $1,$2,$3,$5}'
    

    The first three columns would be picked from file1, and the fourth skipped, then pick the first column from the second file.

提交回复
热议问题