追加目录中的所有文件并在 UNIX 中添加一列

appending all files in directory and adding a column in UNIX

我在一个目录中有几个输出文件;例如

out100

out200

out300

...

...

所有这些文件都包含一列多个能量数值。我想将所有这些文件编译成一个文件中的一长列。我还想添加一个额外的列,以便我知道它来自哪个原始文件....我该怎么做?

例如

100 6546

100 3566

100 3563

200 3566

200 ...

200 ... 

300 ... 

300 ... 

300 ...
.
.
.

提前致谢!

通过使用您给出的示例,这将起作用。

awk '{print FILENAME, [=10=]}' `ls out???` | sed 's/out//'