【发布时间】:2016-07-15 10:43:43
【问题描述】:
合并具有相同列名的多个 txt 文件,从文件名创建一个新列。寻找一个unix解决方案。
例如。
file1.txt
country player age
USA Ben 24
file2.txt
country player age
UK John 27
file3.txt
country player age
Spain Alex 28
Germany Hubber 26
预期输出 合并文件.txt
filename country player age
file1 USA Ben 24
file2 UK John 27
file3 Spain Alex 28
file3 Germany Hubber 26
我试过$ cat file*.txt > merged_files.txt
如何从文件名的右侧添加一个附加列?
【问题讨论】: