从一个文本文件复制列数据添加到另一个文本文件的末尾

Copy column data from one text file add to end of another

我正在寻找从 file1 中提取列的 unix cmd 或脚本:

150807
0
9
5

并附加到文件 2:

DATE    150706  150713  150720  150727  *150807*
P1AW01  0       0       0       0       *0*
P1AW02  0       12      12      12      *9*
P1CP01  0       0       0       0       *5*

添加的列需要像 file2 中的其他列一样左对齐和对齐。 最初使用 join 命令,但这会删除添加到 file2 的所有格式和间距。我也在使用旧版本。 korn shell 并且不能使用列工具或 sed -i 选项。

谢谢!

尝试 paste 命令

paste file2 file1 > outputfile